SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    BoOm-Rocka! Smarky's Avatar
    Join Date
    Jun 2000
    Location
    England
    Posts
    1,319
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Same site, different designs!

    Hey,

    I wanna pull off something special with a current project that is mostly just for show in some aspects, not in others. Anyway I wish to offer the users a few different designs to choose from.

    Now I know I could go all CSS Zen Garden on this but I believe this would still limit things a little more than I would like. The idea is to totally be free. Most of it (prob all) will be built on a simple custom PHP CMS system.

    Now I would just like some advice as how to achive this using PHP and what would be the most effective system for achiving this. Obviously things like the selected design will be stored in a cookie but how about actually managing the designs and loading the correct one, directory structure etc

    Is XML and PHP a good match for this job or totally the wrong direction? I'm thinking the CMS can generate flat files for each of the designs, then it's just a matter of fetching the correct design, how would I achive this? some kinda includes to fetch them for example index.php would fetch design2/index,php and include it in index.php to have the desired effect or is there something more clever i can do here?

    How would you tackle the project? What kinda logic and functions would you use (not asking for the whole code here!) Just the direction you would go in and how it would be implemented!

    Thanks!
    Garlic bread, I've tasted it, it's the future

  2. #2
    SitePoint Zealot devscripts's Avatar
    Join Date
    Sep 2004
    Location
    ur monitor
    Posts
    175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if its any use to u, i use a very simple method.
    using css to have different layouts. and the php script uses sessions example.. below..

    if (isset($_SESSION['style'])) {
    echo "<link href=\"".$_SESSION['style']."\" rel=\"stylesheet\" type=\"text/css\" media=\"all\">";
    }

    where the value of $_SESSION['style'] is equal to the filename of the css style sheet like blue.css

    now as for letting users choose which style to use... u have a form with select list and using GET method.. as follows...

    if (isset($_GET['style'])) { $_SESSION['style']=$_GET['style'].".css"; }

    and there u have a very simple effective script.

    advantages?
    you only need to make .css files wiith different colors/layouts

    disadvantges?
    you will need to upload alot of style.css files depending on your styles. if u have 5 different styles or layouts.. blue.css red.css yellow.css so on...

    hope this gives u some idea.
    "None of you [truly] believes until he wishes for his brother what he wishes for himself." By The one and Only Prophet Mohammed (Peace and blessings be upon him)

  3. #3
    SitePoint Wizard
    Join Date
    Aug 2004
    Location
    California
    Posts
    1,672
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use a shared codebase outside the HTML public directory and each site has only an identical index.php and a config.php with the specific settings for that site.


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
  •