Django-cms菜单模板标签问题

发布于 2024-10-26 11:12:16 字数 475 浏览 6 评论 0原文

嗨,我现在完全被这个问题困扰了,我真的希望有人能帮助我解决这个问题。

我有一个 django / django-cms 版本,其中包含很多页面。该网站分为 4 个主要部分,假设这些部分是祖父母。每个祖父母可以有多个孩子,而孩子又可以有任意数量的孩子,所以我们有祖父母、父母和孩子的关系。

基本上我有每个祖父母的导航,其中显示了该部分的所有父母和孩子,如下所示:

{% show_menu_below_id request.current_page.reverse_id %}

我遇到的问题是当我导航时菜单显然开始改变以显示该页面 ID 下面的项目。当我浏览该网站时,我只想显示祖父母部分的菜单,而不是其他页面,

我有 3 个模板,一个用于祖父母,一个用于父母,一个用于孩子。我希望这足够清楚地解释我的问题。只是为了重申,无论我在子菜单中走多远,我只需要菜单,就好像我位于该部分的顶层 IE 毕业生父页面

提前致谢

HI im totally stuck with this one at the moment and i really hope someone can help me out with this problem.

I have a django / django-cms build that contains a lot of pages. the site is divided up in to 4 main sections, lets say these sections are grand parents. each grand parent can have a number of children, which in turn can have any number of children so we have a grandparent, parents and children realtionship going on.

basically i have the nav for each grandparent being display which shows all of the parent and children for that section like so:

{% show_menu_below_id request.current_page.reverse_id %}

the problem i have is as i navigate the menu obviously starts changing to show the items below that pages id. I only want to ever show the menu for grandparent sections not the other pages as i navigate through the site

i have 3 templates one for the grandparents one for the parents and one for the children. I hope this is clear enough to explain my problem. just to re-iterate no matter how far i go down through the sub menu i need to only the menu as if i was at the top level of the section IE the grad parent page

Thanks in advance

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

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

发布评论

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

评论(2

月寒剑心 2024-11-02 11:12:16

我不能百分百确定我明白你想要什么。 “祖父母”页面位于根目录吗?如果是这样,我认为这应该可以解决问题:

{% show_menu 1 %}

它显示第一级的导航(0 级是根级或“祖父母”级)。 文档详细介绍了如何使用 show_menu 标签(这不太直观......)

I'm not 100% sure I understood what you want. Are the "grandparent" pages at the root? If so, I think this should do the trick:

{% show_menu 1 %}

It displays the navigation from the first level (level 0 is the root- or "grandparent"-level). The docs go into more details on how to use the show_menu tag (it's not exactly intuitive...)

写给空气的情书 2024-11-02 11:12:16

为什么不直接展开整个内容,然后在相关页面上你可以厚颜无耻地使用CSS来隐藏你想要隐藏的较低级别。

默认情况下应用了足够的类和内容,您可能可以针对相关领域。

显然这并不理想,但它可能是我能得到的最接近的了。

Why not just have the whole thing expanded, then on the relevant pages you could get a bit cheeky and use CSS to hide the lower levels that you wanted hidden.

There are enough classes and stuff being applied by default that you could probably target the relevant areas.

Obviously it's not ideal, but it's probably about as close as I could get.

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