Hey,
I've made a pretty big website (http://www.game-trix.com), but I've run into a "small" problem now.
The site is divided into 3 segments, namely a header, a footer, and the center file.
The header and footer are included in all the scripts, so if I want to change something, it's easily done.
But, the scripts themselves are just a big jibberish of html combined with PHP.
And guess what, the other people working on the site want to make a new layout.
Since I didn't use any templates or functions for the tables, I would like to implement it now, so any future additions to the site are easily made (or ANOTHER new layout for that matter).
I tried to make the site with functions, so that every table has both a title and a body.
Just like this:
function buildtable($title,$content) {
?>
<table width=500>
<tr>
<td class=menutitle><?echo"$title";?></td>
</tr>
<td class=menuitems><?echo"$content";?></td>
</tr>
</table>
<?
}
But inside the functions, I have to dump a load of HTML since the BODY part of the sometimes contains another table (such as a form which can be found at http://www.game-trix.com/reviews/list.php).
Here's the problem:
When you look at the frontpage, you see another table inside the body table (namely the Nintendo Preview day). I also made a function of that part, just like the buildtable function. But I can not get the buildarticle function to get attached to the content part (variable in this case). When I make a variable for the buildarticle before running the buildtable ($article=buildarticle("IMAGE","TITLE","BODYTEXT")😉, it just doesn't work. It displays before the content of the table I want it to be placed in.
And when I try to do this:
buildtable("TITLE",buildarticle("IMAGE","TITLE","CONTENT")$content);
it doesn't work either.
So, is there perhaps a better way of splitting the HTML from the PHP, so I can easily change layout of the site??
Templates are also an option, but I don't really like em, since the body of the table differs a LOT (different forms, other tables, etc etc). So I would end up making tons of template files.
And I DON'T want to add the form table code in the php script itself preferably, since I want to keep HTML and PHP strictly divided.
Guess this all sounds extremely vague, and yes... it actually is 🙂
So uhm, if nobody understands what I'm telling here, could you please post a link to a tutorial for dividing PHP and HTML without all the clutter 😉
Thanks,
Menno