Using cms ms 1.5.3
I have a lot of pages that all have the same template. But same of them have a different header-images (slideshow in a list ) that are outside of the {content}.
I was thinking to create different global content blocks and include them, so i can use the same template for each page.
And then include the global content block for each page with Page > Option > Extra Page Attribute 1
When i use {global_content name='contentblockname'} as 'Extra Page Attribute 1' then it just prints outs this as text.
Of course i could just include the html-content in 'Extra Page Attribute 1' but it's not easy to edit the html in this text field, and i use the same header-images on some pages so using global content blocks would be a lot easer to maintain.
Is there a way to do this?
[solved] Can i use a global content block specific for each page?
[solved] Can i use a global content block specific for each page?
Last edited by jvdoorn on Thu May 14, 2009 10:33 am, edited 1 time in total.
-
- Forum Members
- Posts: 47
- Joined: Thu Nov 09, 2006 7:33 pm
Re: Can i use a global content block specific for each page?
Hi,
I don't know about using the Extra attribute but you could add a content block oneline and assign it a value and call it. Also you can create a standard so if it isn't assigned then it automatically uses the standard global_content.
Here is an example
{content block="headerfile" oneline="true" assign="headerfile"}
{if $headerfile != ''}
{global_content name="$headerfile"}
{else}
{global_content name="standard"}
{/if}
Thanks,
Chris
I don't know about using the Extra attribute but you could add a content block oneline and assign it a value and call it. Also you can create a standard so if it isn't assigned then it automatically uses the standard global_content.
Here is an example
{content block="headerfile" oneline="true" assign="headerfile"}
{if $headerfile != ''}
{global_content name="$headerfile"}
{else}
{global_content name="standard"}
{/if}
Thanks,
Chris
Re: Can i use a global content block specific for each page?
Hi,
Thanks for you’re reply, but i can't seem to get this code to work.
I have made a couple of global_content blocks, let’s say headerblock1 and headerblock2
In my template i have:
{global_content name="$headerfile"}
And in the page options under "Smarty data or logic that is specific to this page:" i use this:
{content block="headerfile" oneline="true" assign="headerblock1"}
but this gives a "string(55) "Smarty error: unable to read resource: "globalcontent:"" error.
Cheers.
Thanks for you’re reply, but i can't seem to get this code to work.
I have made a couple of global_content blocks, let’s say headerblock1 and headerblock2
In my template i have:
{global_content name="$headerfile"}
And in the page options under "Smarty data or logic that is specific to this page:" i use this:
{content block="headerfile" oneline="true" assign="headerblock1"}
but this gives a "string(55) "Smarty error: unable to read resource: "globalcontent:"" error.
Cheers.
-
- Forum Members
- Posts: 47
- Joined: Thu Nov 09, 2006 7:33 pm
Re: Can i use a global content block specific for each page?
sorry for the confusion...
In your template it should look like this then
*Note Standard is the global content block that you would want to show if the content block is not filled out
Then you go to your page and you will see a content block oneline under your main content area. In that put the name of your GBC that has the header that you want on that page. Then it will replace the $headerblock in here {global_content name="$headerblock"} with the name of the GBC that you want the header to be.
This will allow you to have any different header slideshow on any page. It will just keep replacing $headerblock with sportsheaders or natureheader whatever you decide and as long as you have those as your GBC name your shouldn't get an error. Not sure if there is a better way but it works for me.
Chris
In your template it should look like this then
Code: Select all
{content block="headerblock" oneline="true" assign="headerblock"}
{if $headerblock != ''}
{global_content name="$headerblock"}
{else}
{global_content name="standard"}
{/if}
Then you go to your page and you will see a content block oneline under your main content area. In that put the name of your GBC that has the header that you want on that page. Then it will replace the $headerblock in here {global_content name="$headerblock"} with the name of the GBC that you want the header to be.
This will allow you to have any different header slideshow on any page. It will just keep replacing $headerblock with sportsheaders or natureheader whatever you decide and as long as you have those as your GBC name your shouldn't get an error. Not sure if there is a better way but it works for me.
Chris
Last edited by new2thiscms on Wed May 13, 2009 2:12 pm, edited 1 time in total.
Re: Can i use a global content block specific for each page?
A ha! I see. Thanks a lot for your help.
Got it working now!
Got it working now!
-
- Forum Members
- Posts: 47
- Joined: Thu Nov 09, 2006 7:33 pm