Can I get css to be interpreted by PHP
I'm running a site on shared hosting and am curious if there's a way to modify Apache so css files (as well as js and html) are parsed by PHP. I often run PHP code within these files for various reasons. I added a user-defined MIME type of 'application/x-httpd-php' with the extensions of 'css html js', but that didn't seem to make a difference.
Is it possible to do the above?
Is it possible to do the above?
Thank you for your question about CSS and PHP. CSS and HTML are interpeted client-side by the browser. If you are running PHP code, then you need to use the page extension .php accordingly. A php file can contain CSS and HTML by default but you cannot run php in CSS and HTML files.
Think of it this way, if the file contains PHP then it becomes a php file by default. PHP is executed serverside. AS you visit a php page in the web browser, the CSS and HTML will be rendered by the browser and the PHP code is executed on the server.
I hope this helps!
Gratefully,
Tim S