The great God, look at how this navigation menu loops through the smarty.

Source: Internet
Author: User
The big God look at this navigation menu in the Smarty how to loop out?
This is a part of the code that I took:
{foreach from= $nav _list name=nav_list Item=nav}







{$nav. Title}
Agency profile

{if! $smarty. Foreach.nav_list.last}

{/if}
{/foreach}
------Solution--------------------
What problem are you having now?
------Solution--------------------
You can use your original program more than a few times on the line,
/**
+----------------------------------------------------------
* Get navigation Menu
* $parent _id default for first-level navigation
* $current _module Current page model name
* $current _id current page category ID
+----------------------------------------------------------
*/
function Get_nav1 ($parent _id = 0, $current _module = ", $current _id =", $type = ' middle ')
{
$sql = "SELECT * from". $this->table (' Nav '). "WHERE topid = ' $parent _id ' and (navid=1 or navid=2) ORDER by Sort,navid ASC";
$query = $this->query ($sql);
while ($row = $this->fetch_array ($query))
{
if ($row [' module '] = = ' nav ')
{
$url = $row [' Guide '];
}
ElseIf ($row [' quanpin '] = = 1)
{
$url = $row [' module '];
}
Else
{
$url = $this->rewrite_url ($row [' module '], $row [' Guide ');
}
$nav _list[] = Array (
"id" = $row [' Navid '],
"Nav_name" = $row [' title '],
"url" = $url,
"Sort" = $row [' Paixu '],
"Eng" = $row [' Eng ']
);
}
return $nav _list;
}
According to this, there are not 9 columns, you can get 9 such a No.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.