从内容页面设置模板属性 (sitefinity 4.4)

发布于 2024-12-25 03:25:23 字数 343 浏览 3 评论 0原文

我正在工作的网站的设计方式是为所有页面上的标签设置CSS类,并且所有页面使用的CSS类都不同。每个页面都有常见的元素,例如页眉、页脚和导航栏。我想设置一个单页面模板并在其中包含所有常见元素,但正文标签妨碍了我。有没有办法从内容页面控制模板?我知道我可以为内容页面指定隐藏代码,但我不能依赖内容作者每次添加页面时都正确输入它。我目前的想法是设置多个页面模板,每个模板对应 body 标记中引用的每个 css 类,并将公共页面元素放入用户控件中。这不太理想,因为我最终会得到许多几乎相同的模板,并且我的用户控件将无法轻松编辑。我想我将不得不使用共享内容项目,这使得内容作者在整个网站上进行搜索。我会更简单地更新单页面模板中的公共标题。

有人可以建议一种方法吗?

the site that I'm working at is designed in a such way that CSS class is set for the tag on all the pages and the css classes used are different for all pages. Each page has common elements such as a header, a footer and a nav bar. I'd like to set up a single page template and include all common elements there but the body tag stands in the way. Is there a way to control a template from a content page? I know I can specify a code behind for content pages but i can't rely on content authors to enter it correctly each time they add a page. My current thinking is to set up multiple page template, one for each css class that is referenced in the body tag and put the common page elements into user controls. This is less than ideal because I will end up with lots of mostly identical templates and my user controls would not be editable easily. I guess I would have to use shared content items and such making the content authors hunt all over the site. I would have been much simpler to update the common header in a single page template.

Can someone please suggest a way?

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

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

发布评论

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

评论(1

把回忆走一遍 2025-01-01 03:25:23

我在您最初发布此内容的 Sitefinity 论坛中提交了回复,但以防万一您首先检查这里,我会问同样的问题:body 的 css 类是如何确定的?

如果可以通过编程方式完成,您可以使用模板母版页的代码隐藏来设置它,以便自动处理。

如果这不起作用,请告诉我更多有关如何分配 css 类的信息,我将尝试提出替代方案。

希望这有帮助!

I submitted a reply in the Sitefinity forums where you originally posted this, but just in case you check here first I'll ask the same question: how is the css class for body determined?

if it can be done programmatically you can use the code-behind of the Master Page for the template to set it so that it's handled automatically.

If this won't work, tell me more about how the css class is assigned and I will try to come up with an alternative.

hope this is helpful!

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