Just a note, anyone who can fix this i will send all my $NP and you may have my spare domain name junxster.com 
Hi all i am creating a script in OOP and having some trouble with the templating.
Basically i have this for templating:
All it does really is include a file, but it;s fine for the way i do templating.
Now what is going wrong is with the code below:
It will show the first two $template string but not the $template['end'], infact the whole script seems to stop after the while loop above.
This is the template the code above uses:
This is where the page is http://www.milztech.net/area51/
The whole script is at http://www.milztech.net/mtforum.zip
Any help would be awesome!!
Hi all i am creating a script in OOP and having some trouble with the templating.
Basically i have this for templating:
PHP:
<?php
function get_template($template_file)
{
if (file_exists("./templates/main/" . $template_file . ".tpl.php"))
{
include("./templates/main/" . $template_file . ".tpl.php");
}
else
{
die('Error:Template file ' . $template_file . ' not found');
}
}
?>
All it does really is include a file, but it;s fine for the way i do templating.
Now what is going wrong is with the code below:
PHP:
<?php
// Make global so we can use them here
global $database, $template, $get_latest_topics;
// Start module created for mtforum
// Get the template to use
get_template('start');
// Start the template
echo $template['start'];
$find_latest_topics = $database->sql_query("SELECT * FROM `topics`");
while ($get_latest_topics = $database->sql_fetch($find_latest_topics))
{
// echo the list
echo $template['topics'];
}
// End the template
echo $template['end'];
?>
It will show the first two $template string but not the $template['end'], infact the whole script seems to stop after the while loop above.
This is the template the code above uses:
PHP:
<?php
global $template, $get_latest_topics;
// This is the template
$template['start'] = '
<div align="center">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td>
Latest Topics
</td>
</tr>
<tr>
<td>
Topic
</td>
<td>
Last Poster
</td>
</tr>
';
$template['topics'] = '
<tr>
<td>' .
$get_latest_topics["topic_title"] . '
</td>
</tr>
';
$template['end'] = '
</table>
</div>
';
?>
This is where the page is http://www.milztech.net/area51/
The whole script is at http://www.milztech.net/mtforum.zip
Any help would be awesome!!





