如何在自定义菜单模板中显示“选定页面”?

谢林

我正在使用DDR菜单令牌模板在DNN中创建自己的自定义菜单。

在我的菜单中,我希望选择我当前所在页面的菜单链接。我可以通过使用令牌来实现[SELECTED]但是,无论何时我进入第二层或第三层页面,都不会选择该链接。如何编写代码,以便即使我在“子级”页面中也可以选择“父级页面链接”?

这是我的代码

[>NODE-TOP]
<li class="[?NODE]dropdown[/?][?SELECTED] current active[/?]">
    [?ENABLED]
        <a class="dropdown-toggle forcelink" data-toggle="dropdown" data-hover="dropdown" data-delay="300" href="[=URL]">[=TEXT]<span class="[?NODE]caret[/?]"></a>
    [/?]
    [?NODE]
        <ul class="dropdown-menu">
            [*>NODE]
        </ul>
    [/?]
</li>
[/>]
[>NODE]
<li class="dropdown-submenu">
    [?ENABLED]
            <a href="[=URL]">[=TEXT]<span class="[?NODE]caret-right[/?]"></a>
    [/?]
    [?NODE]
        <ul class="dropdown-menu">
            [*>NODE]
        </ul>
    [/?]
</li>
[/>]

以下是一些可用于DDRMenu的令牌:

NODE - A page
ID - The page ID
TEXT - The page name (i.e. what should normally be displayed in the menu)
TITLE - The full page title
URL - The page URL
ENABLED - Whether the page is enabled
SELECTED - Whether the page is selected
BREADCRUMB - Whether the page is in the current breadcrumb
SEPARATOR - Whether the node is a separator
ICON - The URL of the page icon
LARGEIMAGE - The URL of the large page icon (DNN 6 only)
FIRST - Whether the page is the first in its level
LAST - Whether the page is the last in its level
ONLY - Whether the page is the only one in its level
DEPTH - The depth of the current page in the menu structure (starting at 0)
TARGET - The target window for the url defined for the page (_new or null)
KEYWORDS - The keywords defined for the current page
DESCRIPTION - The description of the current page
TARGET - The target property is used to identify the browser window.
乔·克雷格

您的代码未在较低级别测试SELECTED。那是在以[> NODE]开头的部分。

请注意,还有一个BREADCRUMB,对于痕迹中的所有页面都是正确的。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何在WordPress的自定义页面模板中显示帖子?

如何在自定义ToolStripItem中显示菜单文本?

如何在Django中显示自定义错误页面

如何在其他页面上显示带有自定义字段的模板页面

使用 Prism 和自定义标题栏时如何在 MasterDetail 页面中显示菜单

自定义 django 表单模板(在引导程序中)

自定义表单模板中的Silverstripe访问功能

如何了解自定义树枝表单模板中每个输入的可用变量

如何在自定义管理子菜单页面中打开目标空白?

高级自定义字段无法在自定义页面模板wordpress中显示值

如何在液体shopify模板中隐藏自定义滑轨404页面上的页脚

如何在WordPress自定义页面模板中添加视频?

如何在 wordpress 的自定义模板页面中插入分页

如何在Django中的自定义注册模板中显示错误消息

如何在子菜单中显示自定义帖子类型?

如何在结帐页面显示自定义运费

如何在模板/函数中显示WordPress WooCommerce自定义属性?

如何在Magento 2.1.8中显示自定义模块的模板-不起作用

如何在Magento Fishpig中的自定义模板上显示类别帖子?

Inno Setup:如何在过程InitializeWizard()中显示自定义页面之前如何显示许可证页面;

如何在.net Core 3.0中显示400错误的自定义页面

如何在自定义页面上的购物车中显示产品数量

如何在woocommerce的自定义类别页面中显示产品描述

如何在 Woo Commerce 订单编辑页面中显示结帐自定义字段值?

如何在php中显示子文件夹的自定义404错误页面?

自定义选择在页面刷新后显示选定的值

如何在Fabric中创建自定义帮助菜单?

如何在CSS中自定义下拉菜单?

如何在Bootstrap中自定义折叠菜单