PHP beginner |
|
Ik heb een template en een stuk PHP,
PHP:
<?php
require("pcms/dbconnect.php");
$pagina=$_GET['pag'];
$query = "SELECT * FROM ".$dbPrefix."pages WHERE name='".$pagina."'";
$result = mysql_query($query);
if(mysql_num_rows($result)==0)
{
$query = "SELECT * FROM ".$dbPrefix."pages LIMIT 1";
$result = mysql_query($query);
}
$pagina = mysql_fetch_object($result);
$query = "SELECT * FROM ".$dbPrefix."pages";
$result_menu = mysql_query($query);
$query = "SELECT * FROM ".$dbPrefix."config WHERE name='header'";
$result_header = mysql_query($query);
$result_header = mysql_fetch_object($result_header);
$query = "SELECT * FROM ".$dbPrefix."config WHERE name='pcms_version'";
$result_version = mysql_query($query);
$result_version = mysql_fetch_object($result_version);
$query = "SELECT * FROM ".$dbPrefix."config WHERE name='template'";
$result_template = mysql_query($query);
$result_template = mysql_fetch_object($result_template);
include("templates/class.TemplatePower.inc.php");
$tpl = new TemplatePower("templates/".$result_template->value."/index.tpl");
$tpl->prepare();
$tpl->assign("header", $result_header->value);
$tpl->assign("pagname", $pagina->name);
$tpl->assign("content", $pagina->content);
$tpl->assign("pcms_version", $result_version->value);
while ($menu = mysql_fetch_object($result_menu))
{
$tpl->newBlock("menu");
$tpl->assign("pag", $menu);
}
$tpl->printToScreen();
?>
<?php require("pcms/dbconnect.php"); $pagina=$_GET['pag']; $query = "SELECT * FROM ".$dbPrefix."pages WHERE name='".$pagina."'"; { $query = "SELECT * FROM ".$dbPrefix."pages LIMIT 1"; } $query = "SELECT * FROM ".$dbPrefix."pages"; $query = "SELECT * FROM ".$dbPrefix."config WHERE name='header'"; $query = "SELECT * FROM ".$dbPrefix."config WHERE name='pcms_version'"; $query = "SELECT * FROM ".$dbPrefix."config WHERE name='template'"; include("templates/class.TemplatePower.inc.php"); $tpl = new TemplatePower("templates/".$result_template->value."/index.tpl"); $tpl->prepare(); $tpl->assign("header", $result_header->value); $tpl->assign("pagname", $pagina->name); $tpl->assign("content", $pagina->content); $tpl->assign("pcms_version", $result_version->value); { $tpl->newBlock("menu"); $tpl->assign("pag", $menu); } $tpl->printToScreen(); ?>
Template:
<html>
<head>
<title>{header}</title>
<style type="text/css">
<!--
.header {
font-size: 24pt;
font-family: Comic Sans MS;
color: #8b0000;
text-align: right;
padding-right: 140px;
}
.pagname {
font-size: 18pt;
font-family: ;
color: #4b0082;
text-align: right;
padding-right: 140px;
}
.content {
font-size: 11pt;
font-family: Arial;
overflow: auto;
}
-->
</style></head>
<body>
<table border="0" width="850" align="center">
<tr><td colspan="2" class="header">
{header}</td></tr>
<tr><td colspan="2" class="pagname">
{pagname}</td></tr>
<tr><td width="200" valign="top"><ul>
<!-- START BLOCK : menu -->
<li><a href='?pag={pag}'>{pag}</a></li>
<!-- END BLOCK : menu -->
</ul></td>
<td width="550" valign="top"><div class="content" width="530">
{content}</div>
</td></tr>
<tr><td colspan="2" align="center" valign="bottom" height="60">
<font size="1">Powered by <a href='pcms/' target='_new' title='Peter's Content Managing System'>PCMS</a> {pcms_version}.</font>
</td></tr>
</table>
</body>
</html>
<html> <head> <style type="text/css"> <!-- font-size: 24pt; font-family: Comic Sans MS; color: #8b0000; text-align: right; padding-right: 140px; } .pagname { font-size: 18pt; font-family: ; color: #4b0082; text-align: right; padding-right: 140px; } .content { font-size: 11pt; font-family: Arial; overflow: auto; } --> </style></head> <body> <table border="0" width="850" align="center"> <tr><td colspan="2" class="header"> <tr><td colspan="2" class="pagname"> {pagname}</td></tr> <tr><td width="200" valign="top"><ul> <!-- START BLOCK : menu --> <li><a href='?pag={pag}'>{pag}</a></li> <!-- END BLOCK : menu --> </ul></td> <td width="550" valign="top"><div class="content" width="530"> {content}</div> </td></tr> <tr><td colspan="2" align="center" valign="bottom" height="60"> <font size="1">Powered by <a href='pcms/' target='_new' title='Peter's Content Managing System'>PCMS</a> {pcms_version}.</font> </td></tr> </table> </body> </html>
maar de titel {header} verschijnt niet en ik krijg bij het menu de volgende fout:Citaat: <a href='?pag=
Catchable fatal error: Object of class stdClass could not be converted to string in D:/server/xampp/htdocs/pcms-site/templates/class.TemplatePower.inc.php on line 610 Wat is hier fout en ligt het aan mijn template, mijn php of aan TemplatePower
|