SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Evangelist
    Join Date
    Dec 2005
    Posts
    527
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    dynamic CSS editor

    How can I make a CSS editor that change some values of a valid CSS file ?
    by getting values in a form

  2. #2
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Just like any other output:
    PHP Code:
    body {
      background: <?php echo $bgcolor?>;
      font: <?php echo $font?>;
    }
    Saul

  3. #3
    SitePoint Evangelist
    Join Date
    Dec 2005
    Posts
    527
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you is there any way to open the text file and edit it ?
    replacing text ?

  4. #4
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Yes. You can open it with file_get_contents and use str_replace. If you have this as a simple template engine:

    Code:
    body {
      background: {bgcolor};
      font: {font};
    }
    PHP Code:
    $file=file_get_contents("styles.css");

    $file=str_replace("{bgcolor}"$bgcolor$file);
    $file=str_replace("{font}"$font$file);

    echo 
    $file
    Saul

  5. #5
    SitePoint Evangelist
    Join Date
    Dec 2005
    Posts
    527
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This code can works one time after changing value by user {bgcolor} and {font} dosnt exist

  6. #6
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by bakhanbeigi View Post
    This code can works one time after changing value by user {bgcolor} and {font} dosnt exist
    Not sure what do you mean by that?
    Saul


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •