CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 18th, 2001, 07:57 PM
dexstar dexstar is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2001
Posts: 3 dexstar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
PHP and CSS

Hi..

I was wondering how I can include different css files.

For example, want a visitor to be able to click on a link that would load the same page, with a different css file. Sort of like picking skins.

Can anybody help me? I'd be very grateful!

Thank-you.

Reply With Quote
  #2  
Old June 18th, 2001, 10:04 PM
7stud 7stud is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Feb 2001
Posts: 1,365 7stud User rank is Private First Class (20 - 50 Reputation Level)7stud User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 18 h 20 m 28 sec
Reputation Power: 14
Hi,

For your links' href attribute, which is your php script, include a query sting like this:

href="your_php_script.php?css=style_1"
href="your_php_script.php?css=style_2"
href="your_php_script.php?css=style_3"

Then in your php script do this:
Code:
if ($css == style_1)
{
   include('style_1.css');
}
else if ($css == style_2);
{
  include('style_2.css');
}
else
{
  include('style_3.css');
}

Reply With Quote
  #3  
Old June 19th, 2001, 12:02 AM
dexstar dexstar is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2001
Posts: 3 dexstar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thank you so much! One question - does the code have to go in a certain place, or can it go anywhere?

Thanks again

Reply With Quote
  #4  
Old June 19th, 2001, 12:19 AM
7stud 7stud is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Feb 2001
Posts: 1,365 7stud User rank is Private First Class (20 - 50 Reputation Level)7stud User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 18 h 20 m 28 sec
Reputation Power: 14
Hi,

That's an html question: where would you normally have the text in the css file? The include() function just replaces itself with the text contained in the file you are including as if you had typed it there yourself.

How about inside the <head> tags and between some <style> tags?

Last edited by 7stud : June 19th, 2001 at 12:23 AM.

Reply With Quote
  #5  
Old June 19th, 2001, 05:48 AM
Robert_J_Sherman Robert_J_Sherman is offline
Code Junky
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Location: Central Missouri
Posts: 358 Robert_J_Sherman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 11 m 4 sec
Reputation Power: 0
Send a message via ICQ to Robert_J_Sherman Send a message via MSN to Robert_J_Sherman
Facebook
Though the other answers to this are also correct, another approach to this is through the use of JS.. most of the modern browsers can change css style sheets without reloading the document.

You can see examples of this at:
http://www.projectseven.com/

They use such things as form buttons, to change the style of a page.


Naturally the PHP approach can do this as well, only PHP will have to reload the page. Granted, you could couple the use of a cookie, so your visitor could actually return to your site, using the same style they selected previously.

Pro's and Con's.. the first method I mention, does require JS being enabled.. not really a concern much these days..

I dunno.. I like the PHP idea far better

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > PHP and CSS

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap