Jump to content

[SOLVED] PHP + CSS


Cless

Recommended Posts

My site allows users to edit the layout, and I store all of that in cookies. Now, I know you can mix CSS and PHP, however, as far as I know, you cannot use this code:

 

<link rel="stylesheet" type="text/css" href="style.css" />

 

Seeing as my stylesheet is about a thousand lines long, that can be annoying. Typically, instead of storing it all in a .css file, I have to put it in a PHP/HTML file, such as:

 

<style type="text/css">

.table
{
text-align: center;
border: 1px solid black;
font-size: <?PHP echo $table_font_size; ?>;
}

</style>

 

If I saved that in a .php file, that would work, however it cannot be called upon using HTML, and would likely consume more bandwidth. If I saved it as a .css file, on the other hand, the PHP would not work.

 

Basically; I needed to know whether or not it is possible to combine CSS and PHP without making the page source show the entire thing (or, in other words, use the link rel code).

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/131858-solved-php-css/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.