Php CMS制作简单菜单
我想从这个模板的导航菜单,并把它在我的CMS的简单菜单模板。对我来说,所有关于CMS的简单化都很容易实现,但代码必须用于创建动态菜单。这里有一些代码作为起点Php CMS制作简单菜单,php,twitter-bootstrap,content-management-system,smarty,cmsmadesimple,Php,Twitter Bootstrap,Content Management System,Smarty,Cmsmadesimple,我想从这个模板的导航菜单,并把它在我的CMS的简单菜单模板。对我来说,所有关于CMS的简单化都很容易实现,但代码必须用于创建动态菜单。这里有一些代码作为起点 {strip} {if $count > 0} <ul class="nav navbar-nav navbar-right"> {foreach from=$nodelist item=node} {if $node->depth > $node->prevdepth} {repeat string="
{strip}
{if $count > 0}
<ul class="nav navbar-nav navbar-right">
{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string="<ul class='dropdown'>" times=$node->depth-$node->prevdepth}
{elseif $node->depth < $node->prevdepth}
{repeat string="</li></ul>" times=$node->prevdepth-$node->depth}
</li>
{elseif $node->index > 0}</li>
{/if}
{if $node->current == true}
<li><a href="{$node->url}" class="active" {if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext} </a>
{elseif $node->type == 'sectionheader'}
<li>{$node->menutext}
{elseif $node->type == 'separator'}
<li> <hr class="separator" />
{else}
<li><a href="{$node->url}"{if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext} </a>
{/if}
{/foreach}
{repeat string="</li></ul>" times=$node->depth-1}</li></ul>
{/if}
{/strip}
{strip}
{如果$count>0}
{foreach from=$nodelist item=node}
{如果$node->depth>$node->prevdepth}
{repeat string=“”times=$node->depth-$node->prevdepth}
{elseif$node->depth<$node->prevdepth}
{repeat string=“
”times=$node->prevdepth-$node->depth}
{elseif$node->index>0}
{/if}
{如果$node->current==true}
-
{elseif$node->type=='sectionheader'}
- {$node->menutext}
{elseif$node->type=='separator'}
{else}
-
{/if}
{/foreach}
{repeat string=“
”times=$node->depth-1}
{/if}
{/strip}
下面是我试图生成的导航:
<ul class="nav navbar-nav navbar-right">
<li>
<a href="about.html">About</a>
</li>
<li>
<a href="services.html">Services</a>
</li>
<li>
<a href="contact.html">Contact</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Portfolio <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>
<a href="portfolio-1-col.html">1 Column Portfolio</a>
</li>
<li>
<a href="portfolio-2-col.html">2 Column Portfolio</a>
</li>
<li>
<a href="portfolio-3-col.html">3 Column Portfolio</a>
</li>
<li>
<a href="portfolio-4-col.html">4 Column Portfolio</a>
</li>
<li>
<a href="portfolio-item.html">Single Portfolio Item</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Blog <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>
<a href="blog-home-1.html">Blog Home 1</a>
</li>
<li>
<a href="blog-home-2.html">Blog Home 2</a>
</li>
<li>
<a href="blog-post.html">Blog Post</a>
</li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Other Pages <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>
<a href="full-width.html">Full Width Page</a>
</li>
<li>
<a href="sidebar.html">Sidebar Page</a>
</li>
<li>
<a href="faq.html">FAQ</a>
</li>
<li>
<a href="404.html">404</a>
</li>
<li>
<a href="pricing.html">Pricing Table</a>
</li>
</ul>
</li>
</ul>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
我没有看到针对家长的测试。你需要
{if $node->parent == true}
然后你就可以
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">{$node->menutext} <b class="caret"></b></a>