• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Using variables with global content blocks
PostPosted: Mon Sep 20, 2010 10:51 am 
Offline
New Member
New Member

Joined: Mon Sep 20, 2010 10:28 am
Posts: 7
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:

Code:
<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>


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).


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Using variables with global content blocks
PostPosted: Mon Sep 20, 2010 11:17 am 
Offline
Power Poster
Power Poster
User avatar

Joined: Tue Aug 12, 2008 9:30 pm
Posts: 2071
Location: Feldkirchen in Kärnten, Austria
Hi and welcome.

1. yes you are able to place GCBs in Template.
2. personally i would prefer using a module like Gallery for task you want to achieve.

For example using Gallery you would create new Gallery Template (Content -> Gallery -> Templates) using your code (not tested but you will get the point):
Quote:

    {foreach from=$images item=image}
    {if $image->isdir}
  • {$image->titlename}{$image->comment}

  • {else}
  • {$image->titlename}{$image->comment}

  • {/if}

{/foreach}


As second adding something like this in your template (Layout -> Templates -> Your Template):
Quote:
{capture assign='galdir'}{content block='Gallery' oneline='true'}{/capture} {*gives you input field on each page to enter gallery directory name, we capture this so we can use dir option in Gallery*}
{if !empty($galdir)}
{Gallery template='nameofyourcustomtemplate' dir=$galdir}
{/if}
{*this is placed where your slide should be displayed, if in edit page Gallery directory name is entered it will be displayed on the page*}


Another option would be this, but you would need a gallery for each page alias.
Quote:
{Gallery dir=$page_alias template='yourtemplate'}


There are probably more options, but this is what first came up in my mind.

_________________
CMSMS Blog - I do this!
Forge profile
Github profile
Twitter
=============================================
Support CMSMS


Last edited by uniqu3 on Mon Sep 20, 2010 11:32 am, edited 1 time in total.

Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Using variables with global content blocks
PostPosted: Tue Sep 21, 2010 9:02 am 
Offline
New Member
New Member

Joined: Mon Sep 20, 2010 10:28 am
Posts: 7
Thanks for the reply. I'll look at how I can go about doing it, but I think in order to finish the project I may end up simply inserting the content onto each relevant page. Chances are the client will never update the site anyway.

But you've given me some great ideas, so thanks again.


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
A2 Hosting