Re: php instead css styles

[email protected] (Aziz Saleh)
Newsgroups php.general
Message-ID <CAPJtNhWQudjxaqsdRgAbFSMJ1E62OGtnRuSyWmJcyAgZvL6Kgg@mail.gmail.com>
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 <
[email protected]> 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
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.