[SOLVED] need to load a different image on each page.... how to do this?

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
optimalwebsite
Forum Members
Forum Members
Posts: 10
Joined: Mon Jun 09, 2008 8:32 am

[SOLVED] need to load a different image on each page.... how to do this?

Post by optimalwebsite »

If I have a standard template, and I want to have a different image on each of the 8 pages, (including a flash slideshow on the homepage) how to I code the template / pages so that I can program this in CMSMS?

The image isn't part of the content block, so not sure how to insert this.

Any help appreciated!

Warm Regards,


Joel
Last edited by optimalwebsite on Mon Jun 23, 2008 1:50 pm, edited 1 time in total.
Zoorlat

Re: need to load a different image on each page.... how to do this?

Post by Zoorlat »

Many ways to do this:

a) Add an extra content block to the template where you want the image. Then you can add the image for each page at the same time as you edit the other content.
eg:

Code: Select all

{content block="image"}
b) Use some smarty in the template to assign a specific image to a page, depending on its title. Check out the CGSimpleSmarty module. This way you do not leave it up to the editor to choose the image. See more on this thread: http://forum.cmsmadesimple.org/index.php/topic,22339.0.html (always search the forum, normally most questions have been answered before, even though I understand that it can be difficult to know what to search for when you do not know the answer yet.)

Cheers!
Z
User avatar
kermit
Power Poster
Power Poster
Posts: 693
Joined: Thu Jan 26, 2006 11:46 am

Re: need to load a different image on each page.... how to do this?

Post by kermit »

template code:

Code: Select all

{if $page_alias neq 'yourhomepagealias'}
<img src="uploads/images/pages/{$page_alias}.jpg" alt="$page_alias" />
{else}
<!-- the code you want only on the yourhomepagealias page -->
{/if}
drop these images into ./uploads/images/pages/ and name them by their page_alias, e.g. pagealias.jpg - change yourhomepagealias above to the page_alias of your CMSMS 'home page'
Last edited by kermit on Wed Jun 18, 2008 11:27 am, edited 1 time in total.
eternity (n); 1. infinite time, 2. a seemingly long or endless time, 3. the length of time it takes a frozen pizza to cook when you're starving.
4,930,000,000 (n); 1. a very large number, 2. the approximate world population in 1986 when Microsoft Corp issued its IPO. 3. Microsoft's net profit (USD) for the quarter (3 months) ending 31 March 2007.
CMSMS migration and setup services | Hosting with CMSMS installed and ready to go | PM me for Info
optimalwebsite
Forum Members
Forum Members
Posts: 10
Joined: Mon Jun 09, 2008 8:32 am

Re: need to load a different image on each page.... how to do this?

Post by optimalwebsite »

Figured out a way...

Just installed imagepicker extention. (do this in module manager).

Then inserted code into the template as stated in the help file (see in the module manager for this extention).

Then assigned each page an image in the image picker page ( found in the content).

Works brilliantly!

Joel
Post Reply

Return to “Layout and Design (CSS & HTML)”