Tplpower ?
robmoorman - 13/05/2005 09:56 (laatste wijziging 13/05/2005 10:20)
|
PHP interesse |
|
ik zit het met volgende probleem, ik wil een block in een block aanmaken, maar de inhoud ervan wordt helemaal niet getoont.
hier de tpl code:
<table width="100%" border="0" cellscpacing="0" cellpadding="0">
<!-- START BLOCK : posts -->
<tr>
<td width="70%">
<img src="images/dir.gif" border="0" alt="" />
<!-- START BLOCK : new -->
<font style="color: #FF3300"><b>{title}</b></font>
<!-- END BLOCK : new -->
<!-- START BLOCK : old -->
<b>{title}</b>
<!-- END BLOCK : old -->
</td>
<td width="30%" align="right">{date}</td>
</tr>
<tr>
<td width="100%" colspan="2">Door: <a href="index.php?p=members&id={mid}"><i>{poster}</i></a> <a href="index.php?p=forum&action=posts&id={topicid}&last=1"><img src="images/last.gif" border="0" alt="" /></a></td>
</tr>
<!-- END BLOCK : posts -->
</table>
<table width="100%" border="0" cellscpacing="0" cellpadding="0"> <!-- START BLOCK : posts --> <tr> <td width="70%"> <img src="images/dir.gif" border="0" alt="" /> <!-- START BLOCK : new --> <font style="color: #FF3300"><b>{title}</b></font> <!-- START BLOCK : old --> <b>{title}</b> </td> <td width ="30%" align ="right">{date}</td > </tr> <tr> <td width="100%" colspan="2">Door: <a href="index.php?p=members&id={mid}"><i>{poster}</i></a> <a href="index.php?p=forum&action=posts&id={topicid}&last=1"><img src="images/last.gif" border="0" alt="" /></a></td> </tr> <!-- END BLOCK : posts --> </table>
de BLOCKS posts doen het wel, maar de NEW en OLD komt niks:(
hier mijn phph code:
<?php
global $db;
global $do;
$tpl = new TemplatePower("tpl/blocks/forum.tpl");
$tpl->prepare();
$query = $db->query("SELECT poster, timestamp, topicid FROM forum_posts ORDER BY id DESC LIMIT 0,5");
while ($sql = $db->dump($query))
{
$tpl->newBlock("posts");
$timestamp = $sql["timestamp"];
$date = $do->parseDate($timestamp, "little");
$mid = $sql["poster"];
$topicid = $sql["topicid"];
$poster = $db->getContent("name", "members", "id", $mid);
$title = $do->setLength($db->getContent("title", "forum_topics", "id", $topicid), 12);
$left = time() - $timestamp;
$tpl->assign(array(
"date" => $date,
"mid" => $mid,
"poster" => $poster,
"topicid" => $topicid,
"title" => $title
));
if ($left < FORUM_NEW)
{
$tpl->newBlock("new");
}
else
{
$tpl->newBlock("old");
}
}
$tpl->gotoBlock( "_ROOT" );
$tpl->printToScreen();
?>
<?php $tpl = new TemplatePower("tpl/blocks/forum.tpl"); $tpl->prepare(); $query = $db->query("SELECT poster, timestamp, topicid FROM forum_posts ORDER BY id DESC LIMIT 0,5"); while ($sql = $db->dump($query)) { $tpl->newBlock("posts"); $timestamp = $sql["timestamp"]; $date = $do->parseDate($timestamp, "little"); $mid = $sql["poster"]; $topicid = $sql["topicid"]; $poster = $db->getContent("name", "members", "id", $mid); $title = $do->setLength($db->getContent("title", "forum_topics", "id", $topicid), 12); $left = time() - $timestamp; "date" => $date, "mid" => $mid, "poster" => $poster, "topicid" => $topicid, "title" => $title )); if ($left < FORUM_NEW) { $tpl->newBlock("new"); } else { $tpl->newBlock("old"); } } $tpl->gotoBlock( "_ROOT" ); $tpl->printToScreen(); ?>
FORUM_NEW is defineerd, dus die bevat wel degelijk een correcte waarde.
|
4 antwoorden
Gesponsorde links |
|
Legolas - 13/05/2005 10:48
|
Onbekend |
|
dat assignen moet je aan het eind doen, net voor printtoscreen. want nu assign je em niet, dus werkt ie niet! |
Mr_Dark - 13/05/2005 11:48
|
Lid |
|
<?php
global $db;
global $do;
$tpl = new TemplatePower("tpl/blocks/forum.tpl");
$tpl->prepare();
$query = $db->query("SELECT poster, timestamp, topicid FROM forum_posts ORDER BY id DESC LIMIT 0,5");
while ($sql = $db->dump($query))
{
$tpl->newBlock("posts");
$timestamp = $sql["timestamp"];
$date = $do->parseDate($timestamp, "little");
$mid = $sql["poster"];
$topicid = $sql["topicid"];
$poster = $db->getContent("name", "members", "id", $mid);
$title = $do->setLength($db->getContent("title", "forum_topics", "id", $topicid), 12);
$left = time() - $timestamp;
$tpl->assign(array(
"date" => $date,
"mid" => $mid,
"poster" => $poster,
"topicid" => $topicid,
));
if ($left < FORUM_NEW)
{
$tpl->newBlock("new");
$tpl->assign("titel", $title);
}
else
{
$tpl->newBlock("old");
$tpl->assign("titel", $title);
}
}
$tpl->gotoBlock( "_ROOT" );
$tpl->printToScreen();
?>
<?php $tpl = new TemplatePower("tpl/blocks/forum.tpl"); $tpl->prepare(); $query = $db->query("SELECT poster, timestamp, topicid FROM forum_posts ORDER BY id DESC LIMIT 0,5"); while ($sql = $db->dump($query)) { $tpl->newBlock("posts"); $timestamp = $sql["timestamp"]; $date = $do->parseDate($timestamp, "little"); $mid = $sql["poster"]; $topicid = $sql["topicid"]; $poster = $db->getContent("name", "members", "id", $mid); $title = $do->setLength($db->getContent("title", "forum_topics", "id", $topicid), 12); $left = time() - $timestamp; "date" => $date, "mid" => $mid, "poster" => $poster, "topicid" => $topicid, )); if ($left < FORUM_NEW) { $tpl->newBlock("new"); $tpl->assign("titel", $title); } else { $tpl->newBlock("old"); $tpl->assign("titel", $title); } } $tpl->gotoBlock( "_ROOT" ); $tpl->printToScreen(); ?>
|
CelestialCelebi - 13/05/2005 12:19
|
PHP gevorderde |
|
Beetje omslachtig..
if ($left < FORUM_NEW)
{
$tpl->newBlock("new");
}
else
{
$tpl->newBlock("old");
}
$tpl->assign("titel", $title);
|
robmoorman - 13/05/2005 12:40
|
PHP interesse |
|
ok het werkt, dank je |
Gesponsorde links |
|
Dit onderwerp is gesloten. |
|