Hi rctneil,
First, let me start-out by saying: I am not a PHP guru.

Originally Posted by
rctneil
Thats slightly how my site is done at the moment but i have tonnes of php files with the same template and then the content on those. the header, footer and navigation are brought in via includes.
Sounds good to me. 

Originally Posted by
rctneil
So are you saying i should start again with 1 page as a template and use that variable system? Also the site is
www.atmania.coml
Cool site.
I like to minimize the amount of pages I have to update, so for me a one page PHP template is the way to go. It can be harder to setup (from scratch), but in the end much easier to maintain.

Originally Posted by
rctneil
Could i make page as a template and then make another page with basically all the coding from the others brought in with if $page is this or whatever?
It sounds like you are thinking in the right direction. Basically, for me, I try to put all the PHP in the main template (includes, conditionals, security...) and then only pull-in raw html files or php files (depending on content.)
As far as your site goes...
Looks like you got a lot of content to deal with. Also, looks like you are already using page vars to load content... If you are thinking about doing things how I suggested you would have to make sure all of you links were updated... for example:
http://www.atmania.com/parkguide.php
I click a photo and go here:
http://www.atmania.com/area.php?areaid=1
Now, if you go with the system I mention, your urls would have to look something like this (with domain name - sorry, had to shorten url):
http://www..com/index.php?page=parkguide
and
http://www..com/index.php?page=parkguide&areaid=1
Also, your image gallery could make things tricky... sorry, I can't help too much without seeing how the backend is setup.
Well, let me move on from my way of doing things, to another way... here is a script from 2004 (old, but might give you an idea or two, and maybe others could post something more contemporary):
index.php
PHP Code:
<?php
/* index.php */
include('classes/AwesomeTemplateEngine.class.php');
$aT=new AwesomeTemplateEngine('./templates/');
/* Some sample data */
$data['title']=" AwesomeTemplateEngine Demo ";
$data['message']="You're looking at a revolution in templating.";
$data['table'][1]['item']="include()";
$data['table'][1]['url']="http://www.php.net/include";
$data['table'][2]['item']="class{ }";
$data['table'][2]['url']="http://www.php.net/manual/en/language.oop.php#keyword.class";
$data['poweredby']="Powered by AwesomeTemplateEngine";
/* Show the template */
$aT->parseTemplate($data,"example_template.php");
?>
classes/AwesomeTemplateEngine.class.php
PHP Code:
<?php
/* AwesomeTemplateEngine.class.php */
class AwesomeTemplateEngine {
var $templatePath;
function AwesomeTemplateEngine($templatePath) {
$this->templatePath=$templatePath;
}
function parseTemplate($data,$template) {
include($this->templatePath.$template);
}
}
/* Awesome isn't it? */
?>
templates/example_template.php
PHP Code:
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> <?php echo ($data['title']); ?> </title>
</head>
<body>
<h2 align="center"><?php echo ($data['message']); ?></h2>
<table align="center">
<tr>
<td colspan="2">PHP elements used by AwesomeTemplateEngine:</td>
</tr>
<?php
foreach ($data['table'] as $row) {
?>
<tr>
<td><?php echo ($row['item']); ?></td>
<td><a href="<?php echo ($row['url']); ?>">Read More</a></td>
</tr>
<?php
}
?>
</table>
<p align="center"><?php echo ($data['poweredby']); ?>
<p align="center">The AwesomeTemplateEngine was inspired by
<a href="http://www.sitepointforums.com/showthread.php?s=&threadid=67849">this discussion at Sitepointforums</a>.
Pay close attention to comments by <b>voostind</b>
<p align="center">Flames to the AwesomeTemplateEngine author <a href="http://forum.pinkgoblin.com/viewtopic.php?p=325#325">here</a>
</body>
</html>
Does that help to see some code?
Bookmarks