tpl_categories.php $content = "";
    $content .= '<div id="light_menu" class="menu">ssssssssssssss';
    $content .= $menulist; 
 $content .= '</div>';categories.phprequire_once (DIR_WS_CLASSES . 'categories_ul_generator.php');
  $zen_CategoriesUL = new zen_SiteMapTreeclass;
  $menulist = $zen_CategoriesUL->buildTreeclass();categories_ul_generator.phpclass zen_SiteMapTreeclass {
   var $root_category_id = 0,
       $max_level = 0,
       $data = array(),
       $parent_group_start_string_noif="<ul id='nav'>",
       $root_start_string = '',
       $root_end_string = '',
       $parent_start_string = '',
       $parent_end_string = '',
       $parent_group_start_string = "\n<ul>",
       $parent_group_end_string = "</ul>\n",
       $child_start_string = '<li>',
       $child_end_string = "</li>\n",
       $spacer_string = '',
       $spacer_multiplier = 1;   function zen_SiteMapTree($load_from_database = true) {
     global $languages_id, $db;
  $this->data = array();
 $categories_query = "select c.categories_id, cd.categories_name, c.parent_id
                      from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd
                      where c.categories_id = cd.categories_id
                      and cd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                      and c.categories_status != '0'
                      order by c.parent_id, c.sort_order, cd.categories_name";
         $categories = $db->Execute($categories_query);
         while (!$categories->EOF) {
           $this->data[$categories->fields['parent_id']][$categories->fields['categories_id']] = array('name' => $categories->fields['categories_name'], 'count' => 0);
           $categories->MoveNext();
         }
   }
   
   function buildBranch($parent_id, $level = 0, $parent_link = '') {
  
   if($level == 0){
      $result = $this->parent_group_start_string_noif;
     }else{
      $result =$this->parent_group_start_string;
     }
    if (isset($this->data[$parent_id])) {
      foreach ($this->data[$parent_id] as $category_id => $category) {
        $category_link = $parent_link . $category_id;
        $result .= $this->child_start_string;//child_start_string = '<li>
        if (isset($this->data[$category_id])) {
          $result .= $this->parent_start_string;
        }        if ($level == 0) {
          $result .= $this->root_start_string;
        }
        $result .= str_repeat($this->spacer_string, $this->spacer_multiplier * $level) . '<a href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . $category_link) . '">';
        $result .= $category['name'];
        $result .= '</a>';        if ($level == 0) {
          $result .= $this->root_end_string;
        }        if (isset($this->data[$category_id])) {
          $result .= $this->parent_end_string;
        }//        $result .= $this->child_end_string;       if (isset($this->data[$category_id]) && (($this->max_level == '0') || ($this->max_level > $level+1))) {
         $result .= $this->buildBranch($category_id, $level+1, $category_link . '_');
       }
       $result .= $this->child_end_string;//child_end_string = "</li>\n",     }
   }    $result .= $this->parent_group_end_string;//</ul>    return $result;
  }
   function buildTreeclass() {
     return $this->buildBranch($this->root_category_id);
   }
 }

解决方案 »

  1.   

    $content = "";
        $content .= '<div id="light_menu" class="menu">ssssssssssssss';
        $content .= $menulist; 
     $content .= '</div>';
     $content .= $menulist; 这行运行不出来,前台只会显示这些:<div id="light_menu" class="menu">ssssssssssssss</div>
    方法是从上面上直调用下来的
      

  2.   

    tpl_categories.php  ---》categories.php---》categories_ul_generator.php
      

  3.   

    没有看到引入 tpl_categories.php 的代码$menulist 必须在引入 tpl_categories.php 之前赋值
      

  4.   

    那在调用tpl_categories.php的页面里给$menulist赋值还是怎么改下
      

  5.   

    在你给出的代码中,并没有使用到 $content 变量呀
      

  6.   

    有用到的,前台都可以显示 
    <div id="light_menu" class="menu">ssssssssssssss</div>
    只是这句没有运行出来
      $content .= $menulist; 
      

  7.   

    tpl_categories.php  应该引入categories.php文件<?php
    require_once ('categories.php');
    $content = "";
    $content .= '<div id="light_menu" class="menu">ssssssssssssss';
    $content .= $menulist; 
    $content .= '</div>';
    var_dump($content);
    ?>
      

  8.   

    content是个字符串,menulist是array()??
      

  9.   

    outletugg\includes\classes\categories_ul_generator.php
    outletugg\includes\templates\template_default\sideboxes\tpl_categories.php
    outletugg\includes\modules\sideboxes\template_default\categories.php
    这三个文件路径是这样的,你这样写只能显示部,这个地方就运行出错了,
      

  10.   

    只要有方法调用categories_ul_generator.php这个页面的方法输出HTML代码就可以了
    其他的都可以随便改