Forum Moderators: coopster

Message Too Old, No Replies

Probably a Simple PHP Question

...multiple includes

         

InfaredFog

6:41 am on Sep 22, 2005 (gmt 0)

10+ Year Member



So I have one include on my site working fine, but I want to be able to change multiple ones based on different link clicks. Basically I want to be able to "skin" a site using different color themes with the different includes (I think) being A) Content, B) Header Image, and C) CSS Style. I've played around with it and searched online but couldn't find a good tutorial, and I'm not that great at creating code from scratch. Any suggestions? Thanks.

henry0

11:19 am on Sep 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome again in the "correct forum"!

for a starter look HERE [webmasterworld.com]

entrancesix

12:11 pm on Sep 22, 2005 (gmt 0)



hmmmm.

Includes aside you could change the skin with if statements based on the query string.

if you set a link on your site to /new_music/index.php?blue_skin
and set an if statement in that index.php file (for exmaple we'll change the bgcolor) like this:

<html><head><title>New Music</title></head>
<?php
if ($_SERVER['QUERY_STRING'] == "blue_skin") // so if query = index.php?blue_skin we'll turn the bg blue
{ echo "<body bgcolor=\"#0099FF\">";
}
if ($_SERVER['QUERY_STRING'] == "red_skin") // or if query = index.php?red_skin turn the bg red
{ echo "<body bgcolor=\"#ff0000\">";
}
if ($_SERVER['QUERY_STRING'] == "black_skin") // or if query = index.php?black_skin turn the bg black
{ echo "<body bgcolor=\"#000000\">";
}
elseif ($_SERVER['QUERY_STRING'] == "") // else use default
{ echo "<body bgcolor=\"#fff\">";
}
?>
</body>
</html>

you could write the entire site in an if statement for each skin. hope it helps.

dcrombie

12:58 pm on Sep 22, 2005 (gmt 0)



[csszengarden.com...]

Say no more ;)

InfaredFog

7:53 pm on Sep 22, 2005 (gmt 0)

10+ Year Member



Oo I will say more.

Thanks. =)

henry0

8:39 pm on Sep 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



dcrombie,
am I blind? :)
I cannot see the list of CSS offered by the garden demo
where is it?

coopster

9:24 pm on Sep 22, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



It's on the right hand side of the page, see all the links?

InfaredFog

9:43 pm on Sep 22, 2005 (gmt 0)

10+ Year Member



So entrancesix, if I had a link that pointed to /new_music/index.php?orange_skin it could essentially be an exact copy of the site except I'd use those if statements to echo different (orange in this case) color themes or whatever? And then as I navigated the page regularly those echo'ed themes would stay and the orange site would remain orange?

henry0

10:01 pm on Sep 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Coopster, Only one world: OOOPPPSSS!
thanks