PDA

View Full Version : help with Style Switcher driven by XML



irishmark
10-26-2006, 03:48 PM
I have sucessfully implemented a style swither on my site using the one at http://www.dynamicdrive.com/dynamic...eetswitcher.htm

Now the problem i have with this is that it requires putting the various diffrent alternative style links in the head of every page of my site. So whenever i create a new style sheet I will have to go through every page and add the link to the new css. This also applies if I want to remove a one. At the moment the head of each page looks like this:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Irishmark.net</title>


<link rel="stylesheet" type="text/css" href="http://www.mediachill.com/irishmark/Layouts/Default.css" title="Default" />
<link rel="alternate stylesheet" type="text/css" href="http://www.mediachill.com/irishmark/Layouts/BedLamp.css" title="BedLamp.css" />
<link rel="alternate stylesheet" type="text/css" href="http://www.mediachill.com/irishmark/Layouts/BlueBubbles.css" title="BlueBubbles.css" />
<link rel="alternate stylesheet" type="text/css" href="http://www.mediachill.com/irishmark/Layouts/Carolyn_1.css" title="Carolyn_1.css" />
<link rel="alternate stylesheet" type="text/css" href="http://www.mediachill.com/irishmark/Layouts/Dad.css" title="Dad.css" />
<link rel="alternate stylesheet" type="text/css" href="http://www.mediachill.com/irishmark/Layouts/Interview.css" title="Interview.css" />
<link rel="alternate stylesheet" type="text/css" href="http://www.mediachill.com/irishmark/Layouts/Lucy.css" title="Lucy.css" />
<link rel="alternate stylesheet" type="text/css" href="http://www.mediachill.com/irishmark/Layouts/RedAceSpades.css" title="RedAceSpades.css" />
<link rel="alternate stylesheet" type="text/css" href="http://www.mediachill.com/irishmark/Layouts/Scribbles.css" title="Scribbles.css" />
<link rel="alternate stylesheet" type="text/css" href="http://www.mediachill.com/irishmark/Layouts/Spider.css" title="Spider.css" />
<link rel="alternate stylesheet" type="text/css" href="http://www.mediachill.com/irishmark/Layouts/WhiteBlood.css" title="WhiteBlood.css" />
<link rel="alternate stylesheet" type="text/css" href="http://www.mediachill.com/irishmark/Layouts/WhiteGrundge.css" title="WhiteGrundge.css" />
<link rel="alternate stylesheet" type="text/css" href="http://www.mediachill.com/irishmark/Layouts/DullBasic.css" title="DullBasic" />

<script src="styleswitch.js" type="text/javascript">
</script>


</head>

Now here is my query: Can i adapt this method so that it will call the stylsheets from an xml doc.

The idea being that with each new sheet i create or each sheet i delete I would only have to edit the XML page by adding and deleting links to the new sheets.

Please consider the fact that I am not a coder. It as a feat just getting this current method to work.

Any help would be really appreciated and if anyone can do it I'll give you a big shiney credit and link on my site.

Thanks

mwinter
10-27-2006, 12:09 PM
I have sucessfully implemented a style swither on my site using the one at http://www.dynamicdrive.com/dynamic...eetswitcher.htm

Now the problem i have with this is that it requires putting the various diffrent alternative style links in the head of every page of my site. So whenever i create a new style sheet I will have to go through every page and add the link to the new css. This also applies if I want to remove a one.

Use server-side includes (http://allmyfaqs.net/faq.pl?Include_one_file_in_another).



Please consider the fact that I am not a coder. It as a feat just getting this current method to work.

The methods described above aren't difficult to use; usually just a single line.

Mike

irishmark
10-28-2006, 04:25 PM
Thanks Mike,

I'll give it a go - lol. I'm only grasping concepts here but i am still managing to getstuff working!

irishmark
10-31-2006, 05:02 PM
All Sorted - the php call function works a treat!