0
我正在尋找在我的CMS Made Simple網站上創建導航麪包屑。我正在尋找使用smarty/php,但我遇到了問題,確保它具有未來性 - 即可以處理多個級別。Smarty麪包屑「鏈接」問題
這裏的樣本樹結構我找得到工作:
-Root
-About us
--Test
---Level 3
-Services
-Contact Us
這裏是我的代碼(減去造型):
{assign var="uri" value=$smarty.server.REQUEST_URI|pathinfo}
{assign var="exploded" value="/"|explode:$uri["dirname"]}
<a href="http://{$smarty.server.HTTP_HOST}">Home</a>
{foreach from=$exploded item=element}
{if $element != ""}
::<a href="http://{$smarty.server.HTTP_HOST}/
{foreach from=$exploded item=element2}
{if $element2 != ""}
{$element2}/
{/if}
{/foreach}
">{$element|replace:'-':' '}</a>
{/if}{*close the if blank if*}
{/foreach}
::{$uri["filename"]|replace:'-':' '}
這是我的電流輸出
<a href="http://www.libraryplustrust.org.uk">Home</a>
:: <a href="http://www.libraryplustrust.org.uk/about-us">about us</a>
:: <a href="http://www.libraryplustrust.org.uk/test">test</a>
:: level3
問題在於第二層(測試)沒有被「添加」到「about-us」父文件中。任何想法都會受到熱烈的歡迎。
究竟是什麼網址,你呢? – 2014-09-08 10:44:51