PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

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 Codewalkers Forums Sponsor:
  #1  
Old November 4th, 2002, 02:01 AM
liquidchild liquidchild is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 2 liquidchild User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
When to include?

I am creating a web site that does not use frames and only uses css, however i have the problem that when i go to constuct a .php page from several other .php pages there can rightly only be one <head></head> section, this is not a problem, however in each .php file there is the corresponding css file for that pages layout, so i was wondering without have to create one big css file or without having to include all css files by default if there was some way of writing in one file say header.php (which would include the <head></head> tags, thus requires to include the <link> tags for the css) what css files to include, now this may start to get messy so any suggestions are welcome!

Thanks in advance

Reply With Quote
  #2  
Old November 4th, 2002, 02:11 AM
Matt Matt is offline
Moderator
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
RE: When to include?

Sure, you could have a header.php file that has the head tags..then within that file, you could conditionally include certain css file...something like this should work:
php Code:
Original - php Code
  1.  
  2. switch($_SERVER['PHP_SELF') {
  3.  
  4.   case '/index.php':
  5.     $cssfile = "index.css";
  6.     break;
  7.   case '/news.php':
  8.     $cssfile = "news.css";
  9.     break;
  10.   default:
  11.     $cssfile = "default.css";
  12.     break;
  13. }
  14.  
  15. echo "<LINK REL="stylesheet" TYPE="text/css" HREF="$cssfile">n";


Reply With Quote
  #3  
Old November 4th, 2002, 01:56 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: When to include?

you could just have that one big css file, and use include_once("header.php") on the files that will need the css.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > When to include?


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway