Is it a bad idea to use php in css documents?

I created a css page called style.php and included it at the top:

<?php header("Content-type: text/css"); ?>

It makes you cringe. Is this a terrible idea? I do this because I created a CMS that allows the administrator to control the colors on the pages (therefore, the style.php script queries the database and captures hexadecimal values).

Any thoughts?

+3
source share
4 answers

This is a great solution, just make sure you serve the appropriate headers. See my blog post on a related topic (search for “important headlines” to go to the right section).

One more thing:

, , , ( ), . , ? = Id URL-, ID - , (, ), , .

:

+4

( + -), PHP (mod_php) script php ( fastcgi), ?

, "" CSS ( , , , - PHP )

+5

, , , , CMS, , , , CSS, .

+1

. :

  • ( css )
  • ( , ).
+1

Source: https://habr.com/ru/post/1703230/


All Articles