Play PackRat on Facebook: our feverishly addictive new game

Web help please (CSS)

I'm creating a web site with most of the pages containing the same info. The left will have the sidelinks and the right will be available for advertising.

Can i use css to create an external style sheet to contain the sidelinks so that i dont have to change every page when i need to change the links?

I have created the basic layout using css with a header and footer with 3 columns in the middle for sidelinks, main content and a right column for advertising space.

I'm sure I learned how to do this when i did the college course but I cant remember!

Posted by jameshilton on Feb 05, 2008 in Blab | 9 comments

meggan on Feb 05, 2008

It wouldn't be a CSS file. I think what you want are PHP includes, perhaps? CSS controls the page's visual styles - you want to control content.

Alternatively, there is some way to do it with plain HTML but I don't remember how. The file extension ends up being .shtml though, I think.

jameshilton on Feb 05, 2008

Thanks. I've not done much with PHP, will need to read the books!

I've done exactly what i need to do with frames before but i'm trying to move away from them.

chook on Feb 05, 2008

Frames would work, but PHP would be better. You can for instance have a DIV for the left side/column, have a PHP line like: include("menu.php"); at the right spot, and end the div. The div can be styled by your external CSS. Done!

In the menu.php file, you have all your usual html stuff, all your links, ... and this is the only file you need to modify if you add links later.

Lots of good php references on the net. Try googling "php include" for starters... :)

louiemctool on Feb 05, 2008

yep, PHP or ASP will do exactly what you want. these are called "server-side includes", and the technology is "server-side scripting". you just need to figure out if your host supports .PHP or .ASP extensions.

there are a lot of helpful sites out there, but i would start with w3schools.

:)

senorgooner on Feb 05, 2008

sent u a whisper that will help :)

soprano on Feb 05, 2008

Inside of a PHP file, this will insert the contents of "file1.htm"

<?php
  readfile("file1.htm");
?>

or all on one line:

<?php readfile("file1.htm"); ?>

Just put that where you would put the contents of file1.htm. (And make sure the file where you put that code is a .php file.)

webmonkey on Feb 06, 2008

There are so many ways to accomplish that scenario...CSS is for styling and position. ((Yes, I know it can do a bit more, but let's stick to generalities)) Variable content would fall into the realm of another approach (PHP being my fave - but I should learn asp one of these days)

louiemctool on Feb 06, 2008

ha. what little i know about php and what i've read about asp makes me think they're about as close as C and Java; that is, enough to cut and paste a lot of code back and forth, different enough to confuse the *bleep* outta ya...

:)

katylava on Feb 06, 2008

PHP is much easier to learn.