Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14346

Dynamic CSS using session variables

$
0
0
Hi everyone,

It's my first topic here and I'm not english-speaker so please be lenient ^^
If there are some french-speakers, I began a topic here : https://openclassrooms.com/forum/sujet/c...de-session
I'm using CI since some months to develop my own web platform. My sessions works great and I wish every user can custom his interface color. For that purpose, I store his color on my SQL DB with type "varchar(6)" and I try to reach it in a CSS sheet but it does not work... Here is my CSS code :
PHP Code:
<?php
    header
('content-type: text/css');
    header('Cache-Control: max-age=31536000, must-revalidate');
    session_start();
?>
body{
    --second-color: <?php echo "#" $_SESSION['CouleurInterface'?>;



I tried replacing by this :
PHP Code:
<?php
    header
('content-type: text/css');
    header('Cache-Control: max-age=31536000, must-revalidate');
    session_start();
?>
body{
    --second-color: <?php echo "#" "ff0000" ?>;


and it works great even if nothing is dynamic Big Grin
I naturally tested if my variable " SESSION [' CouleurInterface '] " exists, by showing it in the PHP page and it exists well, with the value which I gave it in the DB for the user (example: ff0000, I'm adding the "#" in the code). Do you know where the problem's come from ? I looked well on the web and however, with the others it works x)

Thanks by advance

PS: if you need more code, don't hesitate asking me because I didn't want to lose you ^^

Viewing all articles
Browse latest Browse all 14346

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>