大神看下这个导航菜单在smarty里怎么循环出来呢?
这是我取了其中一部分代码:
{foreach from=$nav_list name=nav_list item=nav}
{$nav.title} |
机关简介 |
/**<br /> +----------------------------------------------------------<br /> * 获取导航菜单<br /> * $parent_id 默认获取一级导航<br /> * $current_module 当前页面模型名称<br /> * $current_id 当前页面分类ID<br /> +----------------------------------------------------------<br /> */<br /> function get_nav1($parent_id = 0, $current_module = '', $current_id = '', $type = 'middle')<br /> {<br /> $sql = "SELECT * FROM " . $this->table('nav') . " WHERE topid = '$parent_id' and (navid=1 or navid=2) ORDER BY sort,navid ASC";<br /> $query = $this->query($sql);<br /> while ($row = $this->fetch_array($query))<br /> {<br /> if ($row['module'] == 'nav')<br /> {<br /> $url = $row['guide'];<br /> }<br /> elseif ($row['quanpin'] == 1)<br /> {<br /> $url = $row['module'];<br /> }<br /> else<br /> {<br /> $url = $this->rewrite_url($row['module'], $row['guide']);<br /> }<br /> $nav_list[] = array (<br /> "id" => $row['navid'],<br /> "nav_name" => $row['title'],<br /> "url" => $url,<br /> "sort" => $row['paixu'],<br /> "eng" => $row['eng']<br /> );<br /> }<br /> return $nav_list;<br /> }