Hello,
I would like to display a snippet of content (a global content block in my case) only if the current page is also in the menu. Right now, I worked around the problem by duplicating the template, but this isn't a nice solution.
Is there a way to check this with Smarty. If so, how?
Checking if current page is displayed in menu
Checking if current page is displayed in menu
Regards,
Patrick
Patrick
Re: Checking if current page is displayed in menu
Can you clarify what you mean when you say "if the current page is also in the menu"?
There are easy ways to get the alias of the current page and the aliases of the parent and root-level pages to use for conditional logic within your templates. If you can clarify your question, perhaps someone in this forum will be able to given you specific guidance.
-S
There are easy ways to get the alias of the current page and the aliases of the parent and root-level pages to use for conditional logic within your templates. If you can clarify your question, perhaps someone in this forum will be able to given you specific guidance.
-S
Re: Checking if current page is displayed in menu
I am looking for a check that queries if the current visible page is a page that is displayed in the menu. Pages can also be excluded from the menu.
Regards,
Patrick
Patrick
Re: Checking if current page is displayed in menu
@pschoenb - it may be just me but I'm still not clear about what you mean.
I understand the first part - "current visible page", but not sure about the second part "page displayed in menu". Are you referring to pages (like sub-pages) that may not be listed in the main navigation?
So you have a page structure something like this:
- Top Page 1
- Top Page 2
-- Sub Page 2.1
-- Sub Page 2.2
- Top Page 3
Only the Top pages are displayed in the page menu, but users can get to the Sub-pages if they click on some link in the top pages. Once they are there (on the sub-page) you want to be able to display (or hide) specific content that is otherwise hidden (or displayed) on the top-pages.
Is this your specific situation & need?
-S
I understand the first part - "current visible page", but not sure about the second part "page displayed in menu". Are you referring to pages (like sub-pages) that may not be listed in the main navigation?
So you have a page structure something like this:
- Top Page 1
- Top Page 2
-- Sub Page 2.1
-- Sub Page 2.2
- Top Page 3
Only the Top pages are displayed in the page menu, but users can get to the Sub-pages if they click on some link in the top pages. Once they are there (on the sub-page) you want to be able to display (or hide) specific content that is otherwise hidden (or displayed) on the top-pages.
Is this your specific situation & need?
-S
Re: Checking if current page is displayed in menu
No, there is a page option to hide a specific page in the menu. This is what I mean.
Regards,
Patrick
Patrick
Re: Checking if current page is displayed in menu
Ok - got it.
Here's a simple way to do this:
You can adapt this to show/hide content or other content blocks.
Hoep this help.
-S
Here's a simple way to do this:
Code: Select all
{if $content_obj->mShowInMenu != 1}
Hidden in Menu
{else}
Shown in Menu
{/if}
Hoep this help.
-S