Help with Creating A "Choose Layout" Script!!!
Hello, I was wondering if someone could tell me how to do this?
Okay this is what i want to do. Im makeing a website and it has a few layouts. I want the users to be able to change the layout of the site to the one they like best. And i need a cookie that will remember what layout they chose even after they restart.
An example of what I am talking about is at dbgtn.com on the right side of the screen there is a drop down list that says choose layout. I want it to do exactly what that does. If someone could help me then i would greatly appreciate it!
KarenArt posted this at 11:43 — 26th August 2004.
She has: 354 posts
Joined: May 2001
Really the only way to do this right is by changing style sheets.
I am using a cgi script right now to change html headers and footers (and select images) but it's a pain and sooooo not worth the trouble.
I can't wait to switch to a more intuitive way to do it.
You can use php or asp to switch between styles or (if you don't want to use php pages) you can go with a simple javascript switcher.
There's a simple (and very good) css switcher at http://www.alistapart.com/articles/n4switch/.
Best of luck!
gotta finish redesigning my sites so I can show them again.
The purpose of education is... to get more jokes!
kb posted this at 14:06 — 26th August 2004.
He has: 1,380 posts
Joined: Feb 2002
Ok, I have a better way...use PHP to start
#1- Create different headers and footers that are text files (header1.txt, header2.txt, or name appropriately)
#2- Create the different style sheets
#3- Don't include the stylesheet reference in your header, make that in the body as <?=$style?>
#4- And based upon whatever they choose, $style would equal the appropriate category, that would choose the headers/footers and the stylesheet
iblob posted this at 15:57 — 26th August 2004.
They have: 2 posts
Joined: Aug 2004
Um.. you all are thinking i meant "style" as far as font and size and stuff. What i want is for the whole look of the page to change (ie different images, layout, but same content).
Plus I don't know a thing about headers and footers... Never used them before. All I kno about them is in MS Word they go on top and bottom of the page
EDIT: I am using PHP for my different layouts so that it has the same content for each layout
Megan posted this at 15:59 — 26th August 2004.
She has: 11,421 posts
Joined: Jun 1999
We knew what you meant. The most common way of doing this is to design the site with CSS first, then change the stylesheet. See the CSS Zen Garden for reference.
Kyle's directions use a combination of php includes (headers/footers) and style sheets.
Megan
Connect with us on Facebook!
kb posted this at 03:29 — 27th August 2004.
He has: 1,380 posts
Joined: Feb 2002
I knew exactly what you were talkign about....
A header and footer is basically a breaking-up of your page layout. So you design the template, and then break it up, based upon where you want your content. So for example:
<?php
include('/header.txt');
echo \"this is the body text, inside of an open div\";
include('/footer.txt');
?>
That would be the extent of any given page. More or less.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.