Umbraco 模板问题

发布于 2024-09-04 10:32:16 字数 725 浏览 4 评论 0原文

各位 Umbraco 用户,大家好,

我目前正在构建我的第一个 umbraco 网站,由于我对 umbraco 完全陌生,所以我已经遇到了一个问题,我确信这很容易做到。

也就是说,在构建在(开源)CMS 上运行的网站时,我绝不是初学者,因为我一直在使用 Joomla!因为它被称为曼波。

不管怎样,我正在构建的网站在这里: 我的网站

我想做的是在其中包含一些内容当您将鼠标悬停在菜单项之一上时,白色框会发生变化。此外,当您单击链接时,该内容必须保持“活动”(即,如果您单击“个人资料”,我需要用灰色突出显示“个人资料”菜单项,并且白色框内容需要是相关的内容)到“配置文件”菜单项。

在网站上显示多个内容时,最佳做法是什么?我看过有关多个内容占位符的视频,但我从未真正让它发挥作用。我无法在 NavigationPlaceHolder (我放在白色框中的占位符)中显示页面,但那是因为实际页面是 Frontpage.aspx 而不是 WhateverIsInThenavigationPlaceHolder.aspx 如果我转到 mysite.dk/WhateverIsInTheNavigationPlaceHolder。 .aspx 它显示得很好。

我在这里错过了什么:)

提前致谢!如果我的问题在某些方面不清楚,请告诉我,我会尽力更好地解释。

祝一切顺利,

Hi fellow Umbraco users,

I'm currently building my first umbraco website and since I'm completely new to umbraco I've already ran into a problem which I'm sure is pretty straight-forward to do.

That said, I'm by no means a beginner when it comes to building sites that run on a (open source) CMS as I've been using Joomla! since it was called Mambo.

Anyway, the site I'm building is here: my site

What I want to do is to have some content in the white box that changes when you mouseover/hover one of the menu items. Also that content has to stay "active" when you've clicked on a link (i.e. if you click on "Profile" I need to highlight the Profile menu item with the gray color and the white boxs content needs to be what would be related to the Profile menu item.

How do I go about this? What would be the best practice when it comes to showing multiple content on a site? I've watched the video about multiple Content Place Holders, but I never really got it to work. I can't get a page to display in the NavigationPlaceHolder (the placeholder I put in the white box), but thats because the actual page is Frontpage.aspx and not WhateverIsInThenavigationPlaceHolder.aspx. If I go to the mysite.dk/WhateverIsInTheNavigationPlaceHolder.aspx it shows up fine.

What have I missed here? :)

Thanks in advance! If my question is not clear in some ways, please tell me and I will try to explain it better.

All the best,

Bo

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

£冰雨忧蓝° 2024-09-11 10:32:16

查看您的实现时,您所要求的内容有点令人困惑,但这是我可能会做的事情:

我很确定您想要创建一个用户控件来添加,而不是尝试通过模板系统来做到这一点到您的页面模板。 (将其作为宏添加到模板中。)我将在此处使用 XSLT 控件,并将其作为基本输出:

<xsl:variable name="subContentNodes" select="$currentPage/node[@nodeTypeAlias='yourContentNodeType']">

<ul id="content-items-nav">
    <xsl:for-each select="$subContentNodes">
        <li><a href="#subnode-{@id}"><xsl:value-of select="data[@alias='pageBody']" disable-output-escaping="yes" /></a></li>
    </xsl:for-each>
</ul>

然后

<div id="content-items">
    <xsl:for-each select="$subContentNodes">
        <div id="subnode-{@id}"><xsl:value-of select="data[@alias='pageBody']" disable-output-escaping="yes" /></div>
    </xsl:for-each>
</div>

看起来您已经在页面上包含了 jQuery,因此我将添加一个脚本来处理点击:

$("#content-items-nav a").bind("click", function(e) {
    e.preventDefault();
    var contentDiv = $(this).attr('href');
    $("#content-items div").hide();
    $(contentDiv).show();
    $(this).addClass("active");
});

希望对您有帮助。我发现 umbraco 有相当长的学习曲线,但当你进入它时它非常强大。

(注意:我没有对任何代码进行语法检查)

It's a little confusing what you're asking with seeing your implementation, but here is a shot at what I might do:

Rather than trying to do this through the templating system, I'm pretty sure you want to create a user control to add to your page template. (Add it in the template as a macro.) I would use and XSLT control here with this as the basic output:

<xsl:variable name="subContentNodes" select="$currentPage/node[@nodeTypeAlias='yourContentNodeType']">

<ul id="content-items-nav">
    <xsl:for-each select="$subContentNodes">
        <li><a href="#subnode-{@id}"><xsl:value-of select="data[@alias='pageBody']" disable-output-escaping="yes" /></a></li>
    </xsl:for-each>
</ul>

and then later

<div id="content-items">
    <xsl:for-each select="$subContentNodes">
        <div id="subnode-{@id}"><xsl:value-of select="data[@alias='pageBody']" disable-output-escaping="yes" /></div>
    </xsl:for-each>
</div>

It looks like you're already including jQuery on your page, so I would then add a script to handle the clicking:

$("#content-items-nav a").bind("click", function(e) {
    e.preventDefault();
    var contentDiv = $(this).attr('href');
    $("#content-items div").hide();
    $(contentDiv).show();
    $(this).addClass("active");
});

Hope that helps you some. I found there is quite a learning curve to umbraco, but it is quite powerful when you get into it.

(Note: I haven't syntax checked any of the code)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文