Using variables with global content blocks
Posted: Mon Sep 20, 2010 10:51 am
I'm using the latest version of CMSMS (first time user) and would appreciate any advice on using variables to choose whether to display an image on a per-page basis.
For example, I have created a global content block which displays an image carousel. I've used {$page_alias} within the GCB to automatically choose the three images based on the current page alias. Then on the relevant page, I've inserted the GCB and it is correctly displaying the images in the carousel.
So, my questions are:
1. Is there a way to include this GCB on all pages (i.e. in the Template rather than each Page) but only have the carousel display if the image files are found?
2. The image carousel includes a caption which is currently hard-coded, but these captions also need to change per-page/per-image. Ideally these captions would somehow come from variables in the Page content. Is there a way to do this?
3. How would it automatically display as many images as required? Am I better off creating subfolders for each section, named using the page alias, and then using PHP to get a folder listing?
The carousel code is as follows:
I realise this is probably a complex request but being a CMSMS novice, I'm not really sure of the full capabilities of the system (and have read the Wiki and forum topics, and looked at possible modules that could handle all of this).
For example, I have created a global content block which displays an image carousel. I've used {$page_alias} within the GCB to automatically choose the three images based on the current page alias. Then on the relevant page, I've inserted the GCB and it is correctly displaying the images in the carousel.
So, my questions are:
1. Is there a way to include this GCB on all pages (i.e. in the Template rather than each Page) but only have the carousel display if the image files are found?
2. The image carousel includes a caption which is currently hard-coded, but these captions also need to change per-page/per-image. Ideally these captions would somehow come from variables in the Page content. Is there a way to do this?
3. How would it automatically display as many images as required? Am I better off creating subfolders for each section, named using the page alias, and then using PHP to get a folder listing?
The carousel code is as follows:
Code: Select all
<ul id="sliderContent">
<li class="sliderImage"><img src="template/images/sections/{$page_alias}-01.jpg" alt="No job is too big or too small" width="430" height="250" /><span class="top">No job is too big or too small</span> </li>
<li class="sliderImage"><img src="template/images/sections/{$page_alias}-02.jpg" alt="Outstanding warehouse facilities" width="430" height="250" /> <span class="top">Outstanding facilities</span></li>
</ul>