大神看下这个导航菜单在smarty里如何循环出来呢

WBOY
Release: 2016-06-13 12:01:29
Original
982 people have browsed it

大神看下这个导航菜单在smarty里怎么循环出来呢?
这是我取了其中一部分代码:
{foreach from=$nav_list name=nav_list item=nav}
 


                      
                        
                      
                      
                        
                      
                    
{$nav.title}
机关简介

       {if !$smarty.foreach.nav_list.last}
                    大神看下这个导航菜单在smarty里如何循环出来呢
{/if}
{/foreach}
------解决方案--------------------
你现在遇到什么问题了?
------解决方案--------------------
你可以用你原来的程序多循环几次不就行了,
/**<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 />	}
Copy after login
照着这个,不是有9列吗,你就弄9个这样的不就行了。
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template