Control CSS dynamically via PHP [closed]

-2

I'm developing a website, and also a content manager for it, in the manager I control the images of the site and the texts, I wonder if there's any way I can control the font color and the font type of the texts , that is, in the manager, have a color picker (or something similar) for the user to choose the color of the font of a particular text, and also some way of choosing which font type (Times New Roman, Arial, Comic Sans, and others). Any suggestion ?

    
asked by anonymous 09.04.2018 / 21:22

1 answer

2

Is it possible to write dynamic CSS with PHP SIM , would you advise? well, for beginners it's a good idea but if you already have some knowledge on javascript be it intermediate / advanced, you can already use more appropriate tools for this like LESS / SASS , linked to tools such as Webpack , they work very well.

To type CSS with PHP simply set your header and import it into the page where you want to style example ...

PHP

<?php

header("Content-type: text/css");
$cor_fundo = "#999";    

?>

body {
background: <?=$cor_fundo?>;
}

HTML

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

With this in mind, you can manipulate the variables manually, or build a panel to interact with the code ...

    
09.04.2018 / 21:56