NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page templating problem

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 06-04-2006, 12:40 PM THREAD STARTER               #1 (permalink)
The original NP Emo Kid
 
liam_d's Avatar
Join Date: Jan 2005
Location: Plymouth, UK
Posts: 1,693
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"))

????: NamePros.com http://www.namepros.com/programming/204182-templating-problem.html
    {

        include(
"./templates/main/" $template_file ".tpl.php");
????: NamePros.com http://www.namepros.com/showthread.php?t=204182

    }

        

    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!!
liam_d is offline  
Old 06-04-2006, 06:49 PM   #2 (permalink)
NamePros Member
Join Date: Nov 2005
Posts: 122
cytech will become famous soon enough
 



Hey,

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

"</table>
</div>"

Right where it should be.
__________________
CYTechnologies - Professional Website Development and Design

GetCustomerRated.com - Get Customer Rated allows a business to capture genuine word of mouth advertising and place it in a virtual player on their website.
cytech is offline  
Old 06-05-2006, 02:26 AM THREAD STARTER               #3 (permalink)
The original NP Emo Kid
 
liam_d's Avatar
Join Date: Jan 2005
Location: Plymouth, UK
Posts: 1,693
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  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 02:18 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger