creating a table template to ad to each page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
phase
Forum Newbie
Posts: 24
Joined: Sun Jul 18, 2004 10:47 am

creating a table template to ad to each page

Post 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
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post 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
Post Reply