Page 1 of 1

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

Posted: Wed Jun 18, 2008 9:16 am
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

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

Posted: Wed Jun 18, 2008 10:01 am
by cyberman

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

Posted: Wed Jun 18, 2008 10:08 am
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

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

Posted: Wed Jun 18, 2008 11:25 am
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'

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

Posted: Mon Jun 23, 2008 1:49 pm
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