...

View Full Version : Defining style in URL



XeroTrinity
11-06-2006, 11:57 PM
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

mark87
11-07-2006, 12:05 AM
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;
}
?>

XeroTrinity
11-07-2006, 12:11 AM
Would you mind explaining that a little bit as I have no knowledge of anything but HTML and CSS.... :(

mark87
11-07-2006, 12:16 AM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum