[advanced search]
Results from the most recent live auction are here.
20 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Domain Name Industry Newsletter
Go Back   NamePros.Com > Design and Development > Programming
User Name
Password

Old 06-04-2006, 12:40 PM   · #1
liam_d
The original NP Emo Kid
 
liam_d's Avatar
 
Name: Liam Dawe
Location: Plymouth, UK
Trader Rating: (28)
Join Date: Jan 2005
Posts: 1,579
NP$: 128.00 (Donate)
liam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to all
templating problem

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:
PHP Code:
<?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 Code:
<?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 Code:
<?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!!


Please register or log-in into NamePros to hide ads
liam_d is offline   Reply With Quote
Old 06-04-2006, 06:49 PM   · #2
cytech
NamePros Member
 
Trader Rating: (8)
Join Date: Nov 2005
Posts: 113
NP$: 25.00 (Donate)
cytech is on a distinguished road
Hey,

You sure its not showing, because in the source-code on yoru site I see:

"</table>
</div>"

Right where it should be.
cytech is offline   Reply With Quote
Old 06-05-2006, 02:26 AM   · #3
liam_d
The original NP Emo Kid
 
liam_d's Avatar
 
Name: Liam Dawe
Location: Plymouth, UK
Trader Rating: (28)
Join Date: Jan 2005
Posts: 1,579
NP$: 128.00 (Donate)
liam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to allliam_d is a name known to all
Sorry forgot to update my post, issue has resolved.
liam_d is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Site Sponsors
RealTechNetwork free webhosting RealTechNetwork
Advertise your business at NamePros
All times are GMT -7. The time now is 10:35 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0