NYCPHP Meetup

NYPHP.org

[nycphp-talk] Including CSS?

Chris Shiflett shiflett at php.net
Thu Jun 9 14:37:32 EDT 2005


leam at reuel.net wrote:
> The first way I saw to reference a CSS file was to have it in the
> <head> section, like this:
> 
> <link rel="stylesheet" type="text/css"
> href="http://albasystemadmin.org/alba.css">
> 
> But since i'm using include() on some files outside the docroot,
> is there a way to include the css file? Or does to have to be in
> the header?

Is your stylesheet within document root? If it is, the first method that 
you mention is best. This lets the browser handle fetching the 
stylesheet, so it can cache it and issue conditional GETs for subsequent 
requests. This cuts down on your bandwidth consumption.

As per your specific question, just remember that PHP only cares about 
PHP code - CSS, JavaScript, and HTML are all things you output with PHP 
(or place outside of PHP blocks). This stuff is up to you.

Hope that helps.

Chris

-- 
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/



More information about the talk mailing list