|
Dom
|
posted on 12th Jul 06 at 19:16 |
Personally i would put the headers and footer info into a php function, then include that in all of your pages and just print/echo the data - ie:
code:
create a "functions.php" -
function heads() {
strDat = "<HTML><Title>BOB</Title>";
return strDat
}
function foot() {
strDat = "</HTML>";
return strDat
}
Then in say news.php -
include "functions.php";
echo heads();
(blah blah blah info)
echo foots();
Thats how i do it when doing things like this, also means that all my functions are in one place so one file.
However, mikes idea is probably the most straight forward as you dont have to include things all the time etc :thumbs:
[Edited on 12-07-2006 by Dom]
|
Ian
|
posted on 12th Jul 06 at 19:08 |
You might want to regexp the variable to remove anything that isn't a-z.
For the record, here's the policy on u2u'ing me for technical advice - http://www.corsasport.co.uk/board/viewthread.php?tid=189319
DON'T u2u me technical questons :|
|
MikeLamb
|
posted on 12th Jul 06 at 17:26 |
put this in index.php:
<?
include "header.php";
include $_GET["page"].".php";
include "footer.php";
?>
make a file called header.php, put the header in there
make a file called footer.php, put the footer in there
make all the content pages, e.g page1.php, page2.php etc etc
access the pages like this:
http://domain.com/?page=page1
update header & footer.php and every page will update.
|
Alex16v
|
posted on 12th Jul 06 at 16:59 |
If its the stylesheet your just including in each page, just save it as style.css, then use the import@ /style.css to include it in each page. Google css includes, or try pixel2life.com for help. :)
|
poole
|
posted on 12th Jul 06 at 16:55 |
Send me a PM with more information about what you want and ill help you out.
|
Laney
|
posted on 12th Jul 06 at 16:44 |
When I did this I created a template, then included the content, surprisingly using includes!
for example:
index.php?section=news would include the news content.
Hope that helps?
|
Eck
|
posted on 12th Jul 06 at 16:41 |
Best to u2u ian this sort of thing mate.
|
KITcorsa
|
posted on 12th Jul 06 at 16:39 |
if so i have a question as something is pissing me off and i cant for the love of it get it to work!!!!!!!!!
the question is about php and mainly the echo statment.
what im doing is building a site using css etc etc etc
each page has trhe same headers footers and navbar etc, basically only the ifo on the pages changes.
simple enough ya think just copy the code onto everypage and add the info! yes easy! but what happens when i need to add a new button to nav bar, i have to go through each page and cheage each page and on a 30 page site its just to time consuming.
so here where the php comes in
use a echo statement and and have all the pages use the same information for a seporate folder.
Also i dont want to use a database on this site before you think of that!!!!
follow??
thing is i dont have a clue where to start, i can get the echo statment to work on a page is the echos are stated at the top of the page (but this does not cut down the update time at all so pointless) but i would like the statments in a seport folder so all i do is change the file and it changes the whole site. i know this can be done biut i dont know how!
if anyone here knows how please let me know please or if you know a free site on net that will show me!!
thanks alot!
ps this is for a piece of college/uni work but they didn't teach us this but ifs for extra credit :D
|