gpt4 book ai didi

expressionengine - 具有 GWcode 类别的动态深度

转载 作者:行者123 更新时间:2023-12-02 02:10:06 41 4
gpt4 key购买 nike

我无法思考如何使用 GWcode categories 创建动态菜单在表达式引擎中。我希望菜单仅针对当前 {segment_2}(父)类别进入一定深度,而其余父类别仅保持 1 的深度。

例如,如果 url 是:domain.com/products/medical-tables-cabinets/eta-classic-series/它将输出:

<ul class="nav-menu">
<li><a href="#">Power Tables</a></li>
<li class="active submenu"><a href="#">Medical Tables & Cabinets</a>
<ul class="nav-submenu">
<li><a href="#">ETA Alpha Series</a></li>
<li class="active submenu"><a href="#">ETA Classic Series</a>
<ul class="nav-submenu">
<li><a href="#">Entry A</a></li>
<li><a href="#">Entry B</a></li>
<li><a href="#">Entry C</a></li>
</ul>
</li>
<li><a href="#">Style Line Cabinet Models</a></li>
<li><a href="#">Echo Image Series</a></li>
<li><a href="#">Bariatric Series</a></li>
<li><a href="#">Family Practice</a></li>
<li><a href="#">Treatment &amp; Bedside Cabinets</a></li>
<li><a href="#">Managed Care Quick Cabinets</a></li>
<li><a href="#">Recovery Couches</a></li>
</ul>
</li>
<li><a href="#">Pediatric Equipment</a></li>
<li><a href="#">Medical Seating</a></li>
<li><a href="#">Blood Drawing Chairs</a></li>
<li><a href="#">Tubular Steel & Accessories</a></li>
<li><a href="#">Physical Therapy Equipment</a></li>
<li><a href="#">Kangoo by Clinton</a></li>
<li><a href="#">Training Room Furnishings</a></li>
<li><a href="#">Index by Model #</a></li>
<li><a href="#">Clinton-Eco Tables</a></li>
</ul>

最佳答案

我已经开始工作了,但我还需要更深入一点。这是基本概念:

{exp:gwcode_categories
channel="products"
style="linear"
}
{if depth1_start AND segment_2 != cat_url_title}
<li><a href="/products/{complete_path}">{cat_name}</a></li>
{/if}

{if depth1_start AND segment_2 == cat_url_title}
<li class="active submenu"><a href="/products/{complete_path}">{cat_name}</a>
<ul class="nav-submenu">
{/if}

{if depth == 2 AND segment_2 == parent_url_title}
<li{if segment_3 == cat_url_title} class="active"{/if}><a href="/products/{complete_path}">{cat_name}</a></li>
{/if}

{if depth1_end AND segment_2 == parent_url_title}
</ul>
</li>
{/if}
{/exp:gwcode_categories}

关于expressionengine - 具有 GWcode 类别的动态深度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13291302/

41 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com