Re: php instead css styles

From: Date: Mon, 15 Feb 2021 14:07:22 +0000
Subject: Re: php instead css styles
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-327492@lists.php.net to get a copy of this message
Whenever I need to do dynamic cssI would do so by naming the file: style.css.php Then I can do something like: --------------------------------------------- <?php require_once('user_info.php'); header("Content-type: text/css"); ?> .user-<?=$uer_id;?> { background-color: red; } -------------------------------------------- Which I then include normally: <link type="text/css" rel="stylesheet" href="style.css.php" /> On Mon, Feb 15, 2021 at 8:36 AM David Spector < david025@springtimesoftware.com> wrote: > Dear Muhamad, > > Yes, many web-related file operations can be done in PHP easily, using > functions like file_get_contents and file_put_contents. See the PHP > Manual and search the web to answer such basic questions. > > In this case, read in the two styles files, then concatenate them into a > single string and write out that string. Your HTML file can then link to > that new file instead of to the two style files. > > David Spector/Springtime Software >

« previous php.general (#327492) next »