Connecting Tech Pros Worldwide Help | Site Map

CSS files

Des
Guest
 
Posts: n/a
#1: Aug 12 '05
I have renamed all my files from html to PHP. The first problem I
have is CSS can anyone tell me the equivelent for this please.

The URL for this site is http://www.hopechurchuk.com/Development

Desmond.

NC
Guest
 
Posts: n/a
#2: Aug 13 '05

re: CSS files


Des wrote:[color=blue]
>
> I have renamed all my files from html to PHP. The first problem I
> have is CSS can anyone tell me the equivelent for this please.[/color]

The equivalent for WHAT? Your PHP files can refer to an external
stylesheet just like your HTML files do...

Cheers,
NC

Smitro
Guest
 
Posts: n/a
#3: Aug 15 '05

re: CSS files


NC wrote:[color=blue]
> Des wrote:
>[color=green]
>>I have renamed all my files from html to PHP. The first problem I
>>have is CSS can anyone tell me the equivelent for this please.[/color]
>
>
> The equivalent for WHAT? Your PHP files can refer to an external
> stylesheet just like your HTML files do...
>
> Cheers,
> NC
>[/color]

And to add to that, your HTML files only need to be renamed if they
contain PHP.
Alvaro G Vicario
Guest
 
Posts: n/a
#4: Aug 16 '05

re: CSS files


*** Des wrote/escribió (12 Aug 2005 13:46:50 -0700):[color=blue]
> I have renamed all my files from html to PHP. The first problem I
> have is CSS can anyone tell me the equivelent for this please.[/color]

If you need to execute PHP code in your CSS files, just rename them to
*.php and provide the appropriate headers:

<?php

header('Content-Type: text/css');

....

?>

If I were you, I would also test whether browsers cache this CSS. It'd be
stupid if it was requested to the server on each page view.

--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
PHPGB
Guest
 
Posts: n/a
#5: Aug 20 '05

re: CSS files


<comp.lang.php , Alvaro G Vicario ,
alvaro_QUITAR_REMOVE@telecomputer.com>
<14y7gudpme7jj$.k6rwjqooxkzs.dlg@40tude.net>
<Tue, 16 Aug 2005 13:06:34 +0200>
[color=blue]
> If you need to execute PHP code in your CSS files, just rename them to
> *.php and provide the appropriate headers:
>
> <?php
>
> header('Content-Type: text/css');
>
> ...
>
> ?>
>[/color]

Funnily enough I was wondering how to use php in css files last night .

Any problems or pitfalls with the method ? .


--
www.phpguestbook.co.uk
Alvaro G Vicario
Guest
 
Posts: n/a
#6: Aug 22 '05

re: CSS files


*** PHPGB wrote/escribió (Sat, 20 Aug 2005 13:39:07 +0100):[color=blue]
> Funnily enough I was wondering how to use php in css files last night .
>
> Any problems or pitfalls with the method ? .[/color]

As I mentioned, PHP default config makes browsers reload a *.php document
from server everytime it's needed, and the whole point of external CSS
files is having them cached. Yet you can change this behaviour playing
around with header() function. Just be aware of it.

I don't know if there're other problems: I'd just test it under Internet
Explorer, which is the only known browser that prefers file extensions over
Content-Type headers.


--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Closed Thread