从网上找到了css 菜单的代码,想把这些代码整合进由php smart写的模板系统,如何进行整合呢,求思路
比如这种tpl代码.其菜单项是从后台读出,而非固定,我试过包含含药整合的菜单css,在第一句class写上自己要用的类,不过出来的结果不对,应该如何做呢
<div class="sw_cats"><ul>{foreach from=$oCategories->aChildren item=oCategory} <li> <h3>
<a href="{$oCategory->sLink}">
{if $oCategories->iActiveNode == $oCategory->iId}
<strong>{$oCategory->sName}</strong>
{else}
{$oCategory->sName}
{/if}
</a>
</h3>
{* Display Children *} {if is_array($oCategory->oCategoryTree->aChildren)}
{foreach from=$oCategory->oCategoryTree->aChildren item=oChildCategory}
<a href="{$oChildCategory->sLink}">
{if $oCategory->oCategoryTree->iActiveNode == $oChildCategory->iId}
<strong>{$oChildCategory->sName}</strong>
{else}
{$oChildCategory->sName}
{/if}
</a>
<br />
{* Display GrandChildren *}
{if is_array($oChildCategory->oCategoryTree->aChildren)}
{foreach from=$oChildCategory->oCategoryTree->aChildren item=oGrandChildCategory}
<a href="{$oGrandChildCategory->sLink}">
<sub>{if $oChildCategory->oCategoryTree->iActiveNode == $oGrandChildCategory->iId} » {/if}
{$oGrandChildCategory->sName}
</sub>
</a>
<br />
{/foreach}
{/if}
{/foreach}
{/if}
</li>
{* Display link to show expanded category listing if using vertical category *}
{if isset($sVerticalLink)}
<li><a href='{$sVerticalLink}'>Show all</a></li>
{/if}{/foreach}
</ul></div>
比如这种tpl代码.其菜单项是从后台读出,而非固定,我试过包含含药整合的菜单css,在第一句class写上自己要用的类,不过出来的结果不对,应该如何做呢
<div class="sw_cats"><ul>{foreach from=$oCategories->aChildren item=oCategory} <li> <h3>
<a href="{$oCategory->sLink}">
{if $oCategories->iActiveNode == $oCategory->iId}
<strong>{$oCategory->sName}</strong>
{else}
{$oCategory->sName}
{/if}
</a>
</h3>
{* Display Children *} {if is_array($oCategory->oCategoryTree->aChildren)}
{foreach from=$oCategory->oCategoryTree->aChildren item=oChildCategory}
<a href="{$oChildCategory->sLink}">
{if $oCategory->oCategoryTree->iActiveNode == $oChildCategory->iId}
<strong>{$oChildCategory->sName}</strong>
{else}
{$oChildCategory->sName}
{/if}
</a>
<br />
{* Display GrandChildren *}
{if is_array($oChildCategory->oCategoryTree->aChildren)}
{foreach from=$oChildCategory->oCategoryTree->aChildren item=oGrandChildCategory}
<a href="{$oGrandChildCategory->sLink}">
<sub>{if $oChildCategory->oCategoryTree->iActiveNode == $oGrandChildCategory->iId} » {/if}
{$oGrandChildCategory->sName}
</sub>
</a>
<br />
{/foreach}
{/if}
{/foreach}
{/if}
</li>
{* Display link to show expanded category listing if using vertical category *}
{if isset($sVerticalLink)}
<li><a href='{$sVerticalLink}'>Show all</a></li>
{/if}{/foreach}
</ul></div>
把不对的代码贴出来