I've searched and searched for the answer to my question, but I'm not finding the info I need.
How can I exclude a global content block from one page of my site? For example, I have the following in my template:
{global_content name='right-sidebar'}
What do I need to add in order to remove it from one single page?
-------------------------------
Got it:
{if $page_alias != 'page-alias'}
{global_content name='right-sidebar'}
{/if}
[SOLVED] Exclude a global content block from one page
[SOLVED] Exclude a global content block from one page
Last edited by SusanN on Thu Oct 07, 2010 1:43 pm, edited 1 time in total.
-
- Forum Members
- Posts: 103
- Joined: Fri Nov 28, 2008 11:26 am
Re: [SOLVED] Exclude a global content block from one page
Hi Susan,
How did you get this to exclude a single page? i have a page with alias: /free-trial/ how would this work with this piece of code?
To me, that code looks like a conditional comment for including a GCB, not excluding it?
Cheers
How did you get this to exclude a single page? i have a page with alias: /free-trial/ how would this work with this piece of code?
To me, that code looks like a conditional comment for including a GCB, not excluding it?
Cheers
Re: [SOLVED] Exclude a global content block from one page
Another thing that you can do to get rid of the hard-coded page alias in your solution is to leverage the "Extra Page Attribute 1" field in the options panel when editing the page. For the page that you don't want the right sidebar, you can place "noright" in this field, and use the following in your template:
With this method, you or your client can easily control the appearance of the right sidebar on any page without having to edit the template. I'm sure that the AdvancedContent module has a better way to do this.
Code: Select all
{page_attr key='extra1' assign='extra1'}
{if $extra1 != "noright"}
{global_content name='right-sidebar'}
{/if}
Last edited by Wishbone on Fri Nov 05, 2010 4:27 pm, edited 1 time in total.
Re: [SOLVED] Exclude a global content block from one page
Just replace 'page-alias' (the second one) with 'free-trial'. It is excluding it because of '!=' .. If it doesn't equal this page, show the sidebar.beherenow_uk wrote: How did you get this to exclude a single page? i have a page with alias: /free-trial/ how would this work with this piece of code?
To me, that code looks like a conditional comment for including a GCB, not excluding it?
Code: Select all
{if $page_alias != 'free-trial'}
{global_content name='right-sidebar'}
{/if}
Last edited by Wishbone on Fri Nov 05, 2010 4:29 pm, edited 1 time in total.
Re: [SOLVED] Exclude a global content block from one page
Right. I've learned that one recently. The ! means exclude.
-
- Forum Members
- Posts: 103
- Joined: Fri Nov 28, 2008 11:26 am
Re: [SOLVED] Exclude a global content block from one page
Nice work! This is all good guys, thanks for the response.