Jump to content


Photo

Template Engine Problem. Sorta Help [Urgent]


  • Please log in to reply
1 reply to this topic

#1 Demonic

Demonic
  • Members
  • PipPipPip
  • Advanced Member
  • 562 posts

Posted 30 October 2006 - 11:08 PM

Well here me out im using the template Engine i learned by Deadman. Now this is kind of wierd but On a page im doing a while statement like so:

board.php

$category = mysql_query("SELECT * FROM `category` WHERE `delete` = 'n' ORDER BY `order`")or die("There was an error loading the categories:<br />".mysql_error()."");
while($cat = mysql_fetch_array($category)){


then i try and get the forums using an include like so:
board.php

$forumz = '<?php include("sources/forum.php"); ?>';
$TemplateEngine = new TemplateEngine;
$TemplateEngine->TemplateDir = "styles/".$logged[skin]."/templates/";
$TemplateEngine->SelectTemplateFile('category', __LINE__, __FILE__);
$TemplateEngine->ReplaceVars(array(
'CATEGORYNAME' => $cat[name],
'FORUMS' => $forumz,
'CATEGORYID' => $cat[id],
), __LINE__, __FILE__);
$TemplateEngine->Compile();
}

But for some reason the forum page in the sources directory isnt including nothen and im tryna make it so that it selects forums where that category is using the template system.

But its not having an error at all its just not including like we thought it would. Heres the sources/forum.php file:

<?php
include("global_conf.php");

require_once('includes/template_engine.php');
if(!isset($cat[id])){

print "<tr><td colspan=\"5\">".$cat[id]."</td></tr>";

} else {

print "<tr><td colspan=\"5\">error!</td></tr>";

}

$id = $cat[id];

/**
* Get the forum topics for the defined category
*/

$getforum = mysql_query("SELECT * FROM `forums` WHERE `cid` = '".$id."' AND `delete` = 'n' ORDER BY `f_order`") or die("There was an error loading the forums:<br />".mysql_error()."");//Query or die
while($forum = mysql_fetch_array($getforum)){//Get forums

/**
* Create the forum layout
*/

$TemplateEngine = new TemplateEngine;
$TemplateEngine->TemplateDir = "styles/".$logged[skin]."/templates/";
$TemplateEngine->SelectTemplateFile('forums_layout', __LINE__, __FILE__);
$TemplateEngine->ReplaceVars(array(
'FORUMNAME' => $forum[forumname],
'DESCRIPTION' => $forum[description],
'TOPICS' => $forum[topics],
'REPLIES' => $forum[replies],
'LASTPOST' => "Today, 00:00 AM <br /> <strong>In:</strong> Test topic<br /> <strong>By:</strong> Admin",
'ICON' => "<img src=\"http://www.famfamfam.com/lab/icons/silk/icons/folder_add.png\" alt=\"icon\" />",
), __LINE__, __FILE__);
$TemplateEngine->Compile();


}
?>

Now with that said the $cat[id] means nothen and nothen is happening with the forum script no errors nothen its like its a non active script.

Any Ideas how to include the forums part to work under each category using this template engine?

Thanks in advanced.

extra files

category.tpl


<table id="category_{CATEGORYID}" cellpadding="2" cellspacing="1" width="100%" border="0">
<tr>
<td colspan="5" class="head">{CATEGORYNAME}</td>
</tr>
<tr>
<td class="subhead" width="61%" colspan="2">Forum</td>
<td class="subhead" width="9%" align="center">Topics</td>
<td class="subhead" width="9%" align="center">Replies</td>
<td class="subhead" width="20%">LastPoster</td>
</tr>
{FORUMS}
<tr>
<td style="border-bottom: 0px; background-color: #999999; height: 14px;" colspan="5"></td>
</tr>
</table>

forum_layout.tpl
<tr>
<td class="main" width="8%" align="center">{ICON}</td>
<td class="main" width="53%"><strong>{FORUMNAME}</strong><br /><font style="color: #999999;">{DESCRIPTION}</font></td>
<td class="main" width="9%" align="center">{TOPICS}</td>
<td class="main" width="9%" align="center">{REPLIES}</td>
<td class="main" width="20%">{LASTPOST}</td>
</tr>


#2 Demonic

Demonic
  • Members
  • PipPipPip
  • Advanced Member
  • 562 posts

Posted 31 October 2006 - 12:07 AM

help please :( This has been a problem for the last 2 days and still cant fix problem.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users