开发者

CSS with a PHP extension?

开发者 https://www.devze.com 2022-12-30 14:52 出处:网络
I would like to name my css file mystyles.php. All content within will still be css. I\'d like to then include this into my index.php page without using the standard HTML <link> tag. Any directi

I would like to name my css file mystyles.php. All content within will still be css. I'd like to then include this into my index.php page without using the standard HTML <link> tag. Any direction would be ap开发者_Go百科preciated very much.


Start your mystyle.php file with.

header("Content-type: text/css");

Then echo out the elements.


Include styles in your mystyle.php file that should look like this:

<?php

<style type="text/css">
  /* your styles here.......... */
</style>

?>

Now you can include that file using include:

include `mystyle.php`

In the end i wonder why don't you use the stylesheet link instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消