[SOLVED] Hide global content block from some pages

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
User avatar
klendino
Forum Members
Forum Members
Posts: 67
Joined: Wed Oct 19, 2005 8:22 pm

[SOLVED] Hide global content block from some pages

Post by klendino »

Hi

I trying to achieve the following.
I my left column I have a global content block that shows on all pages.
Is there a way to show this content block only on specific pages?

Thanks
Last edited by klendino on Wed Jul 31, 2013 2:08 pm, edited 1 time in total.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Hide global content block from some pages

Post by calguy1000 »

There are lots of ways.
but the most basic one is:

Code: Select all

{if $page_alias == 'foo' || $page_alias == 'bar'}
{global_content name='my_gcb'}
{/if}
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Hide global content block from some pages

Post by velden »

Different templates? Easy to implement after reading http://www.i-do-this.com/blog/86/Smarty ... ade-Simple
and using one of the latest versions of CMSMS.

Other option: (mis)use on of the 'extra page attribute' fields (options tab of 'Edit content' page.
In template:

Code: Select all

{page_attr key='extra1' assign='ex1'}{if $ex1 != 'skipGCB'}{global_content name='my_gcb'}{/if}
In this example you need to type 'skipGCB' (without quotes that is) in the 'extra page attribute 1' field.

If it needs to be more user friendly/fool proof consider using a module like http://dev.cmsmadesimple.org/projects/econtentblocks and add a checkbox.
User avatar
klendino
Forum Members
Forum Members
Posts: 67
Joined: Wed Oct 19, 2005 8:22 pm

Re: [SOLVED] Hide global content block from some pages

Post by klendino »

Thanks for the answers.
Went with Calguy's option and that did the trick.
Post Reply

Return to “CMSMS Core”