Demonic Posted October 30, 2006 Share Posted October 30, 2006 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:[b]board.php[/b][CODE]$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)){[/code]then i try and get the forums using an include like so:[b]board.php[/b][code]$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();}[/code]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 [b]sources/forum.php [/b]file:[code]<?phpinclude("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 diewhile($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();}?>[/code]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[b]category.tpl[/b][code]<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>[/code][b]forum_layout.tpl[/b][code]<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>[/code] Quote Link to comment Share on other sites More sharing options...
Demonic Posted October 31, 2006 Author Share Posted October 31, 2006 help please :( This has been a problem for the last 2 days and still cant fix problem. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.