Log In · Register

 
Switching Themes with PHP
Fabio.
post Dec 5 2005, 03:17 PM
Post #1


^ Mrs. Jonas
*****

Group: Member
Posts: 592
Joined: Apr 2005
Member No: 263,313



The closest I got when searching was this, and it didn't help.

I'm working on another website, and want to be able to switch themes, and like Heather had said, switch it on all pages. It's NOT wordpress, by the way.

I have header.inc and footer.inc, and then index.php which includes both. I know that I can make header2.inc and footer2.inc, but I don't know how to make some sort of dropdown where you can choose whether you want theme 1 or theme 2, and how to make it include the appropriate header and footer.

I tried googling it, but only came up with Wordpress and B2 hacks, which isn't helping me at all.
 
 
Start new topic
Replies
Fabio.
post Dec 6 2005, 10:48 PM
Post #2


^ Mrs. Jonas
*****

Group: Member
Posts: 592
Joined: Apr 2005
Member No: 263,313



Well, I haven't adapted it to work with wordpress yet. The site I'm working on is just a site... but if and when I get it figured out, you'll be the first to know. *writes post-it note* But my guess is that you just create multiple wordpress themes and then just download the plugin (I think there's a link to it in the first post of this thread) to switch between themes. I'm not sure... it might get hairy when you start using other pages.

Anyhow. PROBLEM.

So I followed that tutorial completely, and... well, it works, for the most part. It switches the theme, but when you go back to browsing the original site, it goes back to the original theme.

Here's the site: http://writersblock.melilyn.com/index.php [it's still under a lot of construction, and the themes are just example themes, but if you click on 'theme switcher' you'll see what I mean.]

HELP? cry.gif
 
*mipadi*
post Dec 6 2005, 10:54 PM
Post #3





Guest






QUOTE(Fabio. @ Dec 6 2005, 10:48 PM)
Here's the site: http://writersblock.melilyn.com/index.php [it's still under a lot of construction, and the themes are just example themes, but if you click on 'theme switcher' you'll see what I mean.]

HELP?  cry.gif
*

The theme information is passed along in the query string--the part of the URL that says ?newskin=2 or whatever. However, the main page link links back to index.php, and loses the value in the query string. You have to keep passing the value along; you can do that by making sure all your links end in something like this:

CODE
<a href="page.php?newskin=<?php echo $_GET['newskin']; ?>">link text</a>
 
Fabio.
post Dec 6 2005, 11:06 PM
Post #4


^ Mrs. Jonas
*****

Group: Member
Posts: 592
Joined: Apr 2005
Member No: 263,313



QUOTE(mipadi @ Dec 6 2005, 10:54 PM)
You have to keep passing the value along; you can do that by making sure all your links end in something like this:

CODE
<a href="page.php?newskin=<?php echo $_GET['newskin']; ?>">link text</a>

*


Would I do this for each and every link on the entire site? Or just the link back to the index?

Thank you for helping, by the way...

Edit: Ahh, all of them. I tested it out and it seems to work. So my problem is resolved, it's just Michelle still! <3

Thanks, Michael.

This post has been edited by Fabio.: Dec 6 2005, 11:28 PM
 

Posts in this topic
Fabio.   Switching Themes with PHP   Dec 5 2005, 03:17 PM
mipadi   Are you doing it for a general website? It's f...   Dec 5 2005, 03:48 PM
Fabio.   I think that's what I'm looking for. Let m...   Dec 5 2005, 07:25 PM
Fabio.   -sorry, double post-   Dec 5 2005, 07:25 PM
insomniac   are you looking for this: http://codegrrl.com/tuto...   Dec 5 2005, 09:08 PM
Fabio.   QUOTE(insomniac @ Dec 5 2005, 9:08 PM)are you...   Dec 6 2005, 07:19 PM
mipadi   QUOTE(Fabio. @ Dec 6 2005, 7:19 PM)DOES it af...   Dec 6 2005, 07:26 PM
Heathasm   oh, mel, i bookmarked the site i got my code from...   Dec 6 2005, 04:12 AM
insomniac   QUOTE(Heathasm @ Dec 6 2005, 4:12 AM)oh, mel,...   Dec 6 2005, 09:15 AM
toyo loco   Just be aware that (well according to what people ...   Dec 6 2005, 10:16 AM
Heathasm   no, not at all its just a few lines of php and ext...   Dec 6 2005, 01:39 PM
insomniac   i dont want to steal lisa's bandwidth.. i ...   Dec 6 2005, 05:36 PM
toyo loco   ^ you should ask who knows her bandwith might not ...   Dec 6 2005, 07:09 PM
insomniac   how would you do this with wordpress? .... im n...   Dec 6 2005, 08:37 PM
Fabio.   http://codegrrl.com/tutorials/php/skinning_your_si...   Dec 6 2005, 09:04 PM
insomniac   ^you use wordpress right? how are you doing it?   Dec 6 2005, 09:55 PM
Fabio.   Well, I haven't adapted it to work with wordpr...   Dec 6 2005, 10:48 PM
mipadi   QUOTE(Fabio. @ Dec 6 2005, 10:48 PM)Here...   Dec 6 2005, 10:54 PM
Fabio.   QUOTE(mipadi @ Dec 6 2005, 10:54 PM)You have ...   Dec 6 2005, 11:06 PM
insomniac   QUOTE(Fabio. @ Dec 6 2005, 11:06 PM)Edit: Ahh...   Dec 7 2005, 12:00 AM
insomniac   michael, do you know how to make it work with word...   Dec 6 2005, 10:56 PM
mipadi   QUOTE(insomniac @ Dec 6 2005, 10:56 PM)michae...   Dec 6 2005, 11:00 PM


Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: