Page 1 of 1

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

Posted: Thu Aug 14, 2008 10:41 am
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

Re: Using one template with different images on different pages

Posted: Thu Aug 14, 2008 11:15 am
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

Re: Using one template with different images on different pages

Posted: Thu Aug 14, 2008 11:22 am
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;

}

Re: Using one template with different images on different pages

Posted: Thu Aug 14, 2008 1:08 pm
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

Re: Using one template with different images on different pages

Posted: Thu Aug 14, 2008 3:02 pm
by purplerain12
Thank you verry much.

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

Thanks.

Re: Using one template with different images on different pages

Posted: Fri Aug 15, 2008 7:39 am
by christiaans
Marked solved.