FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


layout changer





assex
Hi,
I need a PHP script that will change the layout of a webpage, i.e., some images and the .css file that it is linked to. How do you do that?
Please help me.
If you don't understand what I am trying to say, please visit the following site and see their layout changer:
http://www.mugglenet.com
Nyizsa
This is not as hard as it looks for the first time.
Make a page using divs & CSS. Copy the CSS to several different names and change the values of colours, pictures and anything you want.
Start your index.php like this:
Code:
<?php
session_start();
$stylesheet='default';
if (isset($_COOKIE['stylesheet'])) $stylesheet=$_COOKIE['stylesheet'];
?>

then later on, in the head section:
Code:
<link rel="stylesheet" type="text/css" href="<?php echo('./styles/'.$stylesheet) ?>.css" />

And to actually change the styles:
Code:
<form name="stylesheet" action="setstyle.php" method="get">
<select name="stylesheet">
<option value="default">Default Style</option>
<option value="second">Style 2</option>
<option value="third">Style 3</option>
</select>
<input type="submit" value="Let's see..." />
</form>

NOTE: name your style sheets according to the option values! (default.css, second.css, etc.)
The setstyle.php mentioned in the action property:
Code:
<?php
setcookie('stylesheet',$_GET['stylesheet'],time()+60*60*24*30);
header('Location: index.php');
?>

And that's all. Quite simple, isn't it? I used a form here to select the style, but you can use pictures also - you will need a little JavaScript then.
I hope it helped.
Stubru Freak
Nyizsa wrote:
... I used a form here to select the style, but you can use pictures also - you will need a little JavaScript then.


Not necessary, for each pitcture you can make a seperate form with a hidden field with name="stylesheet" value="default/style1/style2" then use the following code to make an image button:

Code:
<button type="submit">
<img alt="name of style for users without images" src="urlofimage.png" />
</button>


Then optionally remove the button border using css
Related topics
Okay, I'm done trying to use CSS for layout.
Tieskevo's HOW TO MAKE AN REAL NICE LAYOUT TUTORIAL
..how to make a frames layout?...
100% Expandable Layout Tutorial
[COMMUNITY PROJECT]Frihost Forum
CSS/Layout Help Please!
romedystar.tk - Comment pls
What do you think?
My Nokia site
That typical 3-column layout
That typical 3-column layout
SMU: Jasna's Graphics and Layouts Shop [Closed]
JS vraagje.. Werkt dit?
JS Help Needed...
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.