вот такой у нас есть smarty шаблон

    Date: 09/06/07 (Code WTF)    Keywords: php

    1
    2
    3


      4 {php}
      5 $cursec=(int)$_REQUEST['section'];
      6     $t_tpl=$this->_tpl_vars;
      7     $j=0;
      8     $opendiv=0;
      9     $js=0;
      10     for ($i=0;$i11         if($t_tpl['sections'][$i]->numParents!=0){
      12                 if ($opendiv==0){
      13                 $jscur=0;
      14                 $divid++;
      15                 $starttree=$i-1;
      16                 $starttree1=$j-1;
      17                 $menu[$j-1]='
    • '.$t_tpl['sections'][$i-1]->name.'';
      18                 $menu[$j]='
        ';
        19                 $j++;
        20                 if($cursec==$t_tpl['sections'][$i-1]->id){ 
        21                     $js=' showHideContent(false,1);                 ';
        22                     $jscur=1;
        23                 }
        24                 $opendiv=1;
        25                 }
        26                 if($cursec==$t_tpl['sections'][$i]->id){
        27                     $js=' showHideContent(false,1);                 ';
        28                     $jscur=1;
        29                 }
        30             $menu[$j]='
      • link.'">'.$t_tpl['sections'][$i]->name.'
      • ';
        31
        32         }
        33         else { 
        34         if($opendiv==1){
        35               $menu[$j]='

      36             
    • ';
      37             $j++;
      38             $opendiv=0;
      39             if($jscur===0) {
      40                 $menu = array_slice($menu, 0, $starttree1);
      41                 $menu[$starttree1]='
    • link.'">'.$t_tpl['sections'][$starttree]->name.'
    • ';
      42                 $j=$starttree1+1;
      43                 
      44             }
      45             
      46         }
      47             $menu[$j]='
    • link.'">'.$t_tpl['sections'][$i]->name.'
    • ';
      48         };
      49         $j++;
      50 }
      51 if(!$js) $js='
      52 window.onload = initShowHideDivs;
      53 ';
      54 echo implode("\n", $menu).$js;
      55 {/php}
      56
      57
     
    58

    Source: http://community.livejournal.com/code_wtf/100090.html

« Java. || boolshit »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home