Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Apr 2005
    Location
    Lahore, Pakistan
    Posts
    150
    Thanks
    2
    Thanked 0 Times in 0 Posts

    how to apply themes

    hi,

    i want to implement themes in my project. means i have different themes in a themes folder. The admin has rights to change and apply a new theme. i want that there is a list which shows all themes. when admin apply theme 1, then the header, footer and css of the complete site is change according to theme 1 .

    how can i implement this. what is the logic behind this.

  • #2
    Regular Coder
    Join Date
    Dec 2002
    Location
    UK
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, I personally would have 2 (or more) .css files, each having defined a styling for each of your elements. The class name would be the same in all 2 files.

    You could store the name of the chosen theme in a file, and when you write your <link> tag, you could use PHP.

    PHP Code:
    <html>
    <head>
    <?php
    $cssFile 
    "themes.txt";
    $fh fopen($cssFile'r');
    $theData fread($fhfilesize($cssFile));
    fclose($fh);
    echo 
    "<link rel=\"stylesheet\" type="text/css" href=\"$theData\" />
    ?>
    </head>
    Then all you would have to do is write a function that takes in the name of the file (such as theme3.css, nighttheme.css) and overwrite themes.txt with this.


  •  

    Posting Permissions

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