Page 1 of 1

creating a table template to ad to each page

Posted: Thu Aug 05, 2004 7:56 am
by phase
hi all, im quite new to php and ive just constructed my new site, it works fine, things r good but im now in the process of going through it and cleaning it up as much as i can with my limited knowledge.

my question is theoretical but im sure possible so here goes..

ok throughout my site i have a certain design, i include a head and a footer then the data in between these, on every single php file i have had to include a lot of html for my tables which is the body of the site and makes the code look very messy, im thinking theres must be a way for me to call to a sort of template of the table design of the body and then in every php file just state what data i want where, for example i would have a template of a table to include and then state $title = home $img1 = img src $msg = the main text of the page

i hope this makes sense, basically i dont want to include the bdy html into every single php file as any changes will be soo time consuming to make

if anyone can help i would be extremely grateful, or even point me in the right direction would be great. im feeling i should be looking at functions and calling a start table but this is goin over my head a little at them moment and the research i am doing is losing me.

thank you all in advance

phase

Posted: Thu Aug 05, 2004 11:52 am
by John Cartwright
this is what i do to keep all the html on 1 file. or atleast as much as possible

html.php

Code: Select all

<?

//define all the vars you need here
function maketable($width,$height,etc.)
{
echo "<table width='".$width."' height='".$height."'> <tr><td>";
}

?>
I hope you get the point