CSS with PHP extension?

I would like to name my css file mystyles.php

. All content inside will still be css. I would like to include this in my page index.php

without using the standard HTML tag <link>

. Any direction is greatly appreciated.

+2


a source to share


2 answers


Run the mystyle.php file with.

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

      



Then select the items.

+5


a source


Include the styles in mystyle.php file, which should look like this:

<?php

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

?>

      

Now you can include this file using include

:



include `mystyle.php`

      

In the end, I wonder why you don't use a link to the stylesheet.

+4


a source







All Articles