Jump to content

A simpler question then? Or worded better perhaps....


mulletgut

Recommended Posts

My last post has 35 or more views and no replies, so I'll try to reword what I'm trying to find out.I am try to put a site together which has many pages of content. It is a three column page with a banner. The only part of each page which will be different is the centre "content" area. The far right colum will be like a news headline strip which will need to updated regularly but I want it to be accessable from all pages.I don't want to have to edit all the pages when I make a change to the either the links on the left navigation menu, or the detail in right column (news headlines column).Can this be done using just <div>? Or will I have to use a table and html to specify 2 editable regions?I am confusing myself now. Thanks in advance if anyone can work out what it is I'm asking.

Link to comment
Share on other sites

Research the use of server side includes in php or asp to create a templated layout and then fill the header, nav sidebar, news sidebar and footer div's using includes and the content div based on the "page" which the user selected. There are several ways of doing this, but they all depend on "includes", so start reading and learning php or asp.

Link to comment
Share on other sites

Research the use of server side includes in php or asp to create a templated layout and then fill the header, nav sidebar, news sidebar and footer div's using includes and the content div based on the "page" which the user selected. There are several ways of doing this, but they all depend on "includes", so start reading and learning php or asp.
Will do. Is one language trickier to learn than the other?Thank you.
Link to comment
Share on other sites

Its not difficult to learn how to use php includesI will show you how i did it on a project i worked on a while ago, www.moneyzone.ieIf you click the above link you will see that in everypage certain parts of the page are always the same. Only the center content varies from page to page, this is typical with making webpages. One great way to save time and organise your site is to use php includes. basically you can split your html up into different php files. heres how i did it for moneyzonemoneyzonescreengrabok6.gifto make this work i simply include the seperate php files like this(below is Index.php)

<? require('header.php'); ?><div id="left"><p>blah blah content here etc etc</p></div><?require('rightside.php');require('footer.php');?>

This way if i want to change anything its easy. For example the menu is in header.php so i only have to change that 1 file and i see the change happen throughout the sitehope this helps

Link to comment
Share on other sites

Thanks ste, That was extremely helpful. I know understand the concept of the includes somewhat more than I did.The light bulb went on. I will need to do a lot more learning but I think I just made a bit of a leap.While you're here and are being helpful :)Can I have a single style sheet for all the php includes?Or should the style sheets be internal to each php file?Cheers

Link to comment
Share on other sites

Can I have a single style sheet for all the php includes?
yes, you just call it once in the head of the document (header.php)if you look in the html of the website i posted above it looks like plain html this is because all the php is handled server side unlike javascript. So you wont see <? require('header.php'); ?> when you view the source.Basically think of each php file as a chunk of html you can call. The benefit is you only have to edit one document to see the change throughout the site. Its kind of like a stylesheet or using frames in that wayhope this helps
Link to comment
Share on other sites

<? require('header.php'); ?><div id="left"><p>blah blah content here etc etc</p></div><?require('rightside.php');require('footer.php');?>

Is that the sum total of the code for Index.php ? I'd assume that code goes in the <body> of the page. And no reference to style sheets is needed anywhere but in the head of my header.php? Or am I way off? If it is then this looks like it's going to be fun.

Link to comment
Share on other sites

Looks like a good start, but if you have any issues with the css not working, simply post the header.php code here.Usually, you can create the "included files" from a shell of the page you are trying to mimic with the includes. Write the page as you would normally write an html page, then all the code from the opening DTD to the opening body tag would go into the header.php, the last batch of code would go into the footer.php, the code for the sidebar into the rightside, etc. The only code which is unique to the page is the "content" div which you have shown above. This could also be an include, too, if you want. In a lot of sites, there would be some php / mysql scripting to pull information from a database, for example.Hope this helps. STE did a marvellous job up there, so I hope I am not stepping on his/her toes on this one. Like I said, if you need any more help, post the code snippet and someone will assist you.

Link to comment
Share on other sites

I have combined the header/banner and left nav in one php file as you can see here. Not sure if that will be best. I hope I'm going in the right direction here. That previous bit of code was actually a repeat of what ste posted.I am excited about learning this technique. (I am doing this as a love-job for the fishing/boating club I am in)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><!-- DW6 --><head><!-- Copyright 2005 Macromedia, Inc. All rights reserved. --><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title><link rel="stylesheet" href="3col_leftNav.css" type="text/css" /><style type="text/css"></style></head><body><? require('banner_leftNav.php'); require('headlines.php');?><div id="content">  <div class="feature">    <h3>Outdoor Program </h3>    <p> So I can put this Outdoor programm detail here?	And call this page outdoor_program.php? I think this is going to give me headaches, yet I do see the light at the end of tunnel </p>  </div>  <br /><?require('footer.php');?></body></html>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...