Re: Can you use php in an external css file?
- From: ZeldorBlat <zeldorblat@xxxxxxxxx>
- Date: Thu, 28 Jun 2007 15:07:36 -0700
On Jun 28, 3:06 pm, Leoa <leondria.bar...@xxxxxxxxx> wrote:
I haven't found any answers on this but is it possibile use php in an
external css file, for example:
// mystyle***.css////
.navbg{background-image: url(<?php echo("<?=$img_dir?>")></?php>/
images/Nav_Background.gif);
}
//////<?=$img_dir?> is a url
Sure -- provided that you use proper PHP syntax (which the above is
not). You'll also likely need to name the file with a .php extension
so the web server parses it as such (it's also possible to configure
your web server to parse .css files through PHP, but I wouldn't go
that route).
You should also (you might even need to) put the following at the top
of the file:
header('Content-type: text/css');
.
- References:
- Can you use php in an external css file?
- From: Leoa
- Can you use php in an external css file?
- Prev by Date: Can you use php in an external css file?
- Next by Date: Re: [PHP] Re: strange include path error
- Previous by thread: Can you use php in an external css file?
- Index(es):