0

Hi! I have question, is it possible from web page change information in php file? If it is then how? I tryed search google, but nothing.

For exemple : I open settings page in my browser and there i have section Background color : <and here have input tag> and if i write into the input tag #FFF000 and press save, it's change color code example in some of the page in <body bgcolor="#FFF332(Here)"> tag.

I have seen this in CMS, and i want add to my page.

With regards,
Blaaam.

Edited by blaaam: n/a

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by diafol
1

This could be done via DATABASE - save changes to DB and build a dynamic style profile via php (in <style> tags).

Hard-coding inline styles should be discouraged, with styling and layout being left to CSS (and possibly js). The html should be as clean from clutter and attributes as possible. (My opinion)

Anyway, you could do something like this:

<style>
  body{
    background-color: <?php echo $bgc;?>;
  }
</style>

Where, $bgc is the background colour, either taken from the DB or from a passed/stored variable ($_GET or $_POST or $_COOKIE or $_SESSION).

You could also write to a file (e.g. css) directly with file_get_contents and file_put_contents or similar.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.