Page 1 of 1

[SOLVED] Content across multiple pages?

Posted: Fri Jan 11, 2008 2:26 am
by kandi_nyc
Hi -

I'm a new to CMSMS and having some difficulties trying to accomplish what sounds to be a simple task. I am trying to add an Announcement box that can exist on multiple pages and exists on those pages only if there is an announcement (so not blank). If no announcemnt, I need the box (with the borders) suppressed.  :-\

How can I create one template for this announcement section and let the editor add the contents to it? And how can this announcement be added to select template pages and have it display if the editor has added content for it?  ???

Hope that made sense.  ;D

Thank you in advance for helping out a newbie.

Re: Content across multiple pages?

Posted: Sat Jan 12, 2008 4:02 pm
by nhaack
Hi kandi_nyc,

if it is just one announcement similar for all pages you could go with global content blocks. To enable it page wise, you could add a single line content block to the template. If something is entered in this field, the global content block containing your announcement would be shown.

Presuming you have a global content block called "announce_this" containing your announcement.

You could also go for different templates. So if you'd like to turn on the message, you just switch templates (to a template containing the global content block). But if have a few more templates or would like more combinations possible, you end up with a dozend or more templates, which might disturb you or not.


The following code would go into the template where you want your announcement to be shown and creates a new content block which you'll see when you edit a page based on this template. We'll use this page content block as a switch to turn the display of the global content block on and off.

Code: Select all


{content block='show_announcement' assign='show' oneline='true'}

   {if !empty($show)}
 
	 {global_content name='announce_this'}

   {/if}

This code assigns the content of the content block "show_announcement" you have entered in the template to a variable called $show. It then checks if the variable is empty. If it is not, it will display the global content block "announce_this".

It works for me though I don't know if there isn't a more elegant way to do it.

Can anyone tell me if checkboxes are available for enabling more flexible templates?

greetings
nils

Re: Content across multiple pages?

Posted: Sat Jan 12, 2008 4:10 pm
by kandi_nyc
Thanks nhaack! This is so helpful ~ it is exactly what I needed. Much appreciated  :D