Inexperienced HTML question, <div>...

Soldato
Joined
26 Aug 2006
Posts
9,726
Location
62.156684,-49.781113
Right, I've done plenty of other stuff in my degree so far, but not had any reason to learn any HTML :)

I've got a site set up, with <div> sections, for a header, footer and main body. For a particular part of the site, I'd like to add a menu on the left, which then spawns the content in the main body space to the right of it.

Can anybody point me to the best way to do this? I don't want to have to create a whole new page for each of the entries...

TIA!
 
As far as I know its normal to create a new page for each section of content. The only way round it that I know of would be to use frames which are bad practice.
 
But then every time I added an entry to a main section, I'd have to update every other page with the new left menu?

Is there a completely different way to do it? :)
 
Server-side includes or frames are the main methods. You could also try using Dreamweaver templates, they have a similar function to SSI.
 
But I know frames are bad... I'll take a look at the Dreamweaver view tomorrow.

I don't know if I'm thinking of it wrongly, my searches aren't proving very productive either! :(

Would creating it in PHP be the best way, displaying text on the right according to the article chosen on the left?
 
I think you're actually looking at content management, if I understand what you're saying correctly. You can't do it with basic HTML and CSS.

Have a look at WordPress if you want some basic content management :) Just make sure you install the anti-spam mod, it works well. Either that or get ready for some serious php'age!
 
The guy I'm making the site for wants it for complaining to the council basically, all I've got so far is:

http://ishullright.tsohost.co.uk

Under the sections of particular things to complain about, there's going to be short entries with photographs. So, rather than just having a really long page (which I could resort to), I imagined a menu down the left with the most recent entry at the top. Guessing I'll have to do some quick PHP learning :)

EDIT: and it'll be him that'll eventually be updating it. Which means the long page might be easier...
 
Last edited:
simple way to get the header and footer in..

basically make those sections in separate files.
ie top.html, and bottom.html (endings don't actually matter)

then simple php includes..

<?php
include('top.html');
?>

<!--- content goes here --->

<?php
include('bottom.html');
?>

obviously if you want easily updateable content then you should look at a database/text file based system. Isn't too difficult really, plenty of nice tutorials out there.

Mat
 
Joomla does look simple enough, then he could do everything himself... But not truly customisable, in that I'd have to use a pre-defined theme.

Think I'll go with it for now, then change to entirely my own build when I've got more free time over summer.
 
I would use PHP myself, I use this script on all of my sites I develop:

Code:
	<?php
	// Include script - wrote by Jamie Oliver
	// www.alpha-lite.co.uk
	
	$id = $_GET['id'];
	$folder = 'files/';
	if (empty($id)) {$include = 'default';}
	else if (file_exists($folder.$id.'.php')) {$include = $id;}	
	else {$include = '404';}
	include($folder.$include.'.php');
	
	?>

Bascially, the script includes the relevent page according to the id. For example, going onto www.yoursite.com/index.php?id=about would include the 'about.php' file in your 'files' folder. Get me?

Feel free to use it :p You can see an example of it in use here: www.alpha-lite.co.uk
 
I like that, hadn't thought of doing it that way. Showing my lack of site building here, PHP's easy enough to learn as I expected though :)
 
jamieoliver22 said:
I would use PHP myself, I use this script on all of my sites I develop:

Code:
	<?php
	// Include script - wrote by Jamie Oliver
	// www.alpha-lite.co.uk
	
	$id = $_GET['id'];
	$folder = 'files/';
	if (empty($id)) {$include = 'default';}
	else if (file_exists($folder.$id.'.php')) {$include = $id;}	
	else {$include = '404';}
	include($folder.$include.'.php');
	
	?>

Bascially, the script includes the relevent page according to the id. For example, going onto www.yoursite.com/index.php?id=about would include the 'about.php' file in your 'files' folder. Get me?

Feel free to use it :p You can see an example of it in use here: www.alpha-lite.co.uk

That's bad.. mmmmkay?

Tidy up the code to prevent:

http://www.alpha-lite.co.uk/?id=../index
 
jamieoliver22 said:
It's only a basic code.. And yeah, I did fix the ../ problem before but forgot to save it, and have forgotten to do it again since. Thanks, I will sort it out.
Sorry if I sounded out of place. It is just something I *always* forget to do.

Simple way to do it would be "if string contains anything but A-Z/a-z, reject/replace".

I'll do it for you if you're stuck.
 
Back
Top Bottom