Log in

View Full Version : Php coding question, help please! :)



Rawien
08-16-2008, 10:15 AM
I used to have my own site and recently wanted to restart it up, but I have no files, so I'm relearning from scratch. I used to have it set up so all my CSS, background images etc were saved to 1 index.php file, and all the other pages referenced to loading the php file, and all i would do is copy and paste that code, and then put in the information for the page (basic html) ... The reason I used that method was if I wanted to quickly change the font color for instance on every page on my site I only had to modify the php file. Does anyone recall or know the code to load PHP that way? My explanation sucks but an example might be..

Php file info: Includes CSS, Photos, Background colors, Font information

Page 1 file info: (code to load the PHP info), Text, text, text, links, etc

Any help is appreciated, Its frustrating me!

rangana
08-16-2008, 11:22 AM
Maybe you mean to use php's include() (http://us3.php.net/include/).

jeaux
08-17-2008, 03:11 PM
I think ranagana was right but a better solution for you might be to just use "external" CSS.
Put something like this in between your <head> tags.
<link href="../CSSFolder/Whatever.css" rel="stylesheet" type="text/css" />

As long as you have good semantic markup you can work miracles with CSS.
You could link as many pages as you wanted to the one "Whatever.css" style sheet.

Check this site out.
http://www.csszengarden.com/
Every one of the layouts use the exact same markup.

Hope that helps.

Twey
08-17-2008, 04:14 PM
<link href="../CSSFolder/Whatever.css" rel="stylesheet" type="text/css" />Except without the NET shorttag. See http://www.webdevout.net/articles/beware-of-xhtml.