PHP beginner |
|
hallo,
ik maak gebruik van TemplatePower, maar ik zit met een probleem met het includen van templates. ik krijg namelijk deze error:
Citaat: Notice: Object of class TemplatePower to string conversion in D:apachefriendsxamppxampphtdocsadictivincludesclass.TemplatePower.inc.php on line 135
Fatal error: Cannot redeclare class templatepower in D:apachefriendsxamppxampphtdocsadictivincludesclass.TemplatePower.inc.php on line 867
dit is mijn script:
<?php
error_reporting(E_ALL);
require "includes/connect.php";
require "includes/class.TemplatePower.inc.php";
mysql_connect($mysql['host'], $mysql['user'], $mysql['pass']);
mysql_select_db("adictiv");
$qMenu = mysql_query("SELECT * FROM main WHERE visible=1 ORDER BY place");
if(isset($_GET['p']) && is_numeric($_GET['p']))
{
$pid = $_GET['p'];
}
else
{
$pid = 1;
}
$qContent = mysql_query("SELECT * FROM main WHERE id='".$pid."'");
$aContent = mysql_fetch_assoc($qContent);
$qNews = mysql_query("SELECT * FROM news ORDER BY id DESC LIMIT 0,5");
$qForum = mysql_query("SELECT * FROM forumtracker ORDER BY id DESC LIMIT 0,5");
if(is_file($aContent['file']))
{
$tpl = $aContent['tpl'];
$php = $aContent['file'];
}
else
{
$tpl = "templates/error.tpl";
$php = "error.php";
}
//TemplatePower Starten.
$tpl = new TemplatePower("templates/index.tpl");
$tpl->assignInclude("content", $tpl, T_BYVAR);
//TemplatePower voorbereiden.
$tpl->prepare();
//Niewssysteem voeden.
while($aNews = mysql_fetch_assoc($qNews))
{
$tpl->newBlock("news");
$tpl->assign(array("nid" => $aNews['id'], "newstitel" => $aNews['titel']));
}
//Forumtracker voeden.
while($aForum = mysql_fetch_assoc($qForum))
{
$tpl->newBlock("forum");
$tpl->assign(array("cid" => $aForum['cid'], "tid" => $aForum['tid'], "forumtitel" => $aForum['title']));
}
//Menu weergeven.
while($aMenu = mysql_fetch_assoc($qMenu))
{
if($pid == $aMenu['id'])
{
$naam = '<font color="#0188b4">'.$aMenu['naam'].'</font>';
}
else
{
$naam = $aMenu['naam'];
}
$tpl->newBlock("menu");
$tpl->assign(array("pid" => $aMenu['id'], "naam" => $naam));
}
$tpl->gotoBlock("_ROOT");
include($php);
//Site weergeven.
$tpl->printToScreen();
?>
<?php require "includes/connect.php"; require "includes/class.TemplatePower.inc.php"; $qMenu = mysql_query("SELECT * FROM main WHERE visible=1 ORDER BY place"); { $pid = $_GET['p']; } else { $pid = 1; } $qContent = mysql_query("SELECT * FROM main WHERE id='".$pid."'"); $qNews = mysql_query("SELECT * FROM news ORDER BY id DESC LIMIT 0,5"); $qForum = mysql_query("SELECT * FROM forumtracker ORDER BY id DESC LIMIT 0,5"); { $tpl = $aContent['tpl']; $php = $aContent['file']; } else { $tpl = "templates/error.tpl"; $php = "error.php"; } //TemplatePower Starten. $tpl = new TemplatePower("templates/index.tpl"); $tpl->assignInclude("content", $tpl, T_BYVAR); //TemplatePower voorbereiden. $tpl->prepare(); //Niewssysteem voeden. { $tpl->newBlock("news"); $tpl->assign(array("nid" => $aNews['id'], "newstitel" => $aNews['titel'])); } //Forumtracker voeden. { $tpl->newBlock("forum"); $tpl->assign(array("cid" => $aForum['cid'], "tid" => $aForum['tid'], "forumtitel" => $aForum['title'])); } //Menu weergeven. { if($pid == $aMenu['id']) { $naam = '<font color="#0188b4">'.$aMenu['naam'].'</font>'; } else { $naam = $aMenu['naam']; } $tpl->newBlock("menu"); $tpl->assign(array("pid" => $aMenu['id'], "naam" => $naam)); } $tpl->gotoBlock("_ROOT"); include($php); //Site weergeven. $tpl->printToScreen(); ?>
Wie weet een oplossing?
,,Robin
|