Jump to content

Someone professional.


Demonic

Recommended Posts

Well if I cant get this to function right i might just recode it without template engine.

So im using this code below:
[code]
<?php

include("global_conf.php");


require_once('includes/template_engine.php');

?>
<!--board.php-->

<?php
/**
* Create user panel template
*/
  $TemplateEngine = new TemplateEngine;
  $TemplateEngine->TemplateDir = "styles/".$logged[skin]."/templates/";
  $TemplateEngine->SelectTemplateFile('userpanel', __LINE__, __FILE__);
  $TemplateEngine->ReplaceVars(array(
  'USER' => "Welcome <strong>".$logged[username]."</strong>!",//Username
  'CONTROLS' => "<?php require(\"sources/controls.php\"); ?>",//Username
), __LINE__, __FILE__);
$TemplateEngine->Compile();

/*
* Get the categories
*/

  $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)){


/*
* Create the category template
*/

/* Create Forums from category*/
$showforums = mysql_query("SELECT * FROM `forums` WHERE cid='$cat[id]'") or die(mysql_error());
while($showf = mysql_fetch_array($showforums)){
//
if($showf){
$foruminfo = ('
<tr>
<td class="main" width="8%" align="center">{ICON}</td>
<td class="main" width="53%"><strong>'.$showf[forumname].'</strong><br /><font style="color: #999999;">{DESCRIPTION}</font></td>
<td class="main" width="9%" align="center">'.$showf[topics].'</td>
<td class="main" width="9%" align="center">'.$showf[replies].'</td>
<td class="main" width="20%">{LASTPOST}</td>
    </tr>
');
}else{
$foruminfo = "";
}

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



?>
[/code]

This is what i get when i try and view the forums.

Anyone know how I can make it so that it doesnt repeat the category for each forum and just adds it under the category using this Template System?

view the attachment on what it looks like.

[attachment deleted by admin]
Link to comment
https://forums.phpfreaks.com/topic/26254-someone-professional/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.