[Solved] Using one template with different images on different pages

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
purplerain12
Forum Members
Forum Members
Posts: 110
Joined: Thu Aug 14, 2008 10:33 am

[Solved] Using one template with different images on different pages

Post by purplerain12 »

Hello,

My website has 6 pages and i made 6 different templates that almost looks the same exapt for one image.

Is it possible to make one template and put in a code that says, if you visit site1.php use image1.jpg and if you visit site2.php use image2.jpg?

If this is possbile, how can i do this?

Thanks.

Bas
Last edited by Anonymous on Fri Aug 15, 2008 7:39 am, edited 1 time in total.
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

Re: Using one template with different images on different pages

Post by RonnyK »

You could use logic as described here and modify with something like $pagealias instead... Or retrieve the rootpages alias and use that instead....

http://forum.cmsmadesimple.org/index.ph ... l#msg77986

Ronny
dont

Re: Using one template with different images on different pages

Post by dont »

I use this in my template {random} where the picture must be.

And I created this "user defined tag"


$page = $_GET["page"];

if($page=="example") {

echo "example";

}

else {

$rand = rand(1, 7);
echo $rand;

}
Nick Smart
Forum Members
Forum Members
Posts: 116
Joined: Mon Jul 28, 2008 4:48 pm

Re: Using one template with different images on different pages

Post by Nick Smart »

If you've only got half a dozen pages and a 1:1 relationship between images and pages, then create a second content block in your template and then put the appropriate image link in the second content block on each page. You only need 1 template and no UDTs.

Nick
purplerain12
Forum Members
Forum Members
Posts: 110
Joined: Thu Aug 14, 2008 10:33 am

Re: Using one template with different images on different pages

Post by purplerain12 »

Thank you verry much.

I liked the solution of the user defined tags. I tried and it works fantastic.

Thanks.
christiaans
Power Poster
Power Poster
Posts: 300
Joined: Tue Mar 04, 2008 10:37 am

Re: Using one template with different images on different pages

Post by christiaans »

Marked solved.
Post Reply

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