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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Nov 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Defining style in URL

    Is it possible to define the style of a page in the url of a page?
    Example:
    http://aaotracker.com/portal.php?styleid=2
    http://aaotracker.com/portal.php?styleid=19

  • #2
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You should have asked in the server side section really...

    Something like this could be used on that page:

    <?
    $style = $_GET['styleid'];

    switch($style)
    {
    case '1':
    echo '<link rel="stylesheet" href="style1.css" type="text/css">';
    break;
    case '2':
    echo '<link rel="stylesheet" href="style2.css" type="text/css">';
    break;
    default:
    echo '<link rel="stylesheet" href="style.css" type="text/css">';
    break;
    }
    ?>

  • #3
    New to the CF scene
    Join Date
    Nov 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Would you mind explaining that a little bit as I have no knowledge of anything but HTML and CSS....

  • #4
    Senior Coder
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    2,636
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry! Well the above I posted is PHP; which is a server side language. It is run (by the server) before the rendered code is passed to the browser.

    In that example the code gets the value of 'styleid' in the url, eg. 1 or 2, and enters the code for the specific stylesheet.

    There is a lot if you search Google to learn PHP ( http://www.php.net/ , also http://www.w3schools.com/php/default.asp ), and you can check out the PHP section of this forum. It is probably the most popular server side language.


  •  

    Posting Permissions

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