login  Naam:   Wachtwoord: 
Registreer je!
 Forum

Tplpower ?

Offline robmoorman - 13/05/2005 09:56 (laatste wijziging 13/05/2005 10:20)
Avatar van robmoormanPHP 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:
  1. <table width="100%" border="0" cellscpacing="0" cellpadding="0">
  2. <!-- START BLOCK : posts -->
  3. <tr>
  4. <td width="70%">
  5. <img src="images/dir.gif" border="0" alt="" />
  6. <!-- START BLOCK : new -->
  7. <font style="color: #FF3300"><b>{title}</b></font>
  8. <!-- END BLOCK : new -->
  9. <!-- START BLOCK : old -->
  10. <b>{title}</b>
  11. <!-- END BLOCK : old -->
  12. </td>
  13. <td width="30%" align="right">{date}</td>
  14. </tr>
  15. <tr>
  16. <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>
  17. </tr>
  18. <!-- END BLOCK : posts -->
  19. </table>


de BLOCKS posts doen het wel, maar de NEW en OLD komt niks:(
hier mijn phph code:
  1. <?php
  2.  
  3. global $db;
  4. global $do;
  5.  
  6. $tpl = new TemplatePower("tpl/blocks/forum.tpl");
  7.  
  8. $tpl->prepare();
  9.  
  10. $query = $db->query("SELECT poster, timestamp, topicid FROM forum_posts ORDER BY id DESC LIMIT 0,5");
  11.  
  12. while ($sql = $db->dump($query))
  13. {
  14. $tpl->newBlock("posts");
  15.  
  16. $timestamp = $sql["timestamp"];
  17. $date = $do->parseDate($timestamp, "little");
  18. $mid = $sql["poster"];
  19. $topicid = $sql["topicid"];
  20. $poster = $db->getContent("name", "members", "id", $mid);
  21. $title = $do->setLength($db->getContent("title", "forum_topics", "id", $topicid), 12);
  22.  
  23. $left = time() - $timestamp;
  24.  
  25. $tpl->assign(array(
  26. "date" => $date,
  27. "mid" => $mid,
  28. "poster" => $poster,
  29. "topicid" => $topicid,
  30. "title" => $title
  31. ));
  32.  
  33. if ($left < FORUM_NEW)
  34. {
  35. $tpl->newBlock("new");
  36. }
  37. else
  38. {
  39. $tpl->newBlock("old");
  40. }
  41. }
  42.  
  43. $tpl->gotoBlock( "_ROOT" );
  44.  
  45. $tpl->printToScreen();
  46.  
  47. ?>


FORUM_NEW is defineerd, dus die bevat wel degelijk een correcte waarde.

4 antwoorden

Gesponsorde links
Offline Legolas - 13/05/2005 10:48
Avatar van Legolas Onbekend dat assignen moet je aan het eind doen, net voor printtoscreen. want nu assign je em niet, dus werkt ie niet!
Offline Mr_Dark - 13/05/2005 11:48
Avatar van Mr_Dark Lid
  1. <?php
  2.  
  3. global $db;
  4. global $do;
  5.  
  6. $tpl = new TemplatePower("tpl/blocks/forum.tpl");
  7.  
  8. $tpl->prepare();
  9.  
  10. $query = $db->query("SELECT poster, timestamp, topicid FROM forum_posts ORDER BY id DESC LIMIT 0,5");
  11.  
  12. while ($sql = $db->dump($query))
  13. {
  14. $tpl->newBlock("posts");
  15.  
  16. $timestamp = $sql["timestamp"];
  17. $date = $do->parseDate($timestamp, "little");
  18. $mid = $sql["poster"];
  19. $topicid = $sql["topicid"];
  20. $poster = $db->getContent("name", "members", "id", $mid);
  21. $title = $do->setLength($db->getContent("title", "forum_topics", "id", $topicid), 12);
  22.  
  23. $left = time() - $timestamp;
  24.  
  25. $tpl->assign(array(
  26. "date" => $date,
  27. "mid" => $mid,
  28. "poster" => $poster,
  29. "topicid" => $topicid,
  30. ));
  31.  
  32. if ($left < FORUM_NEW)
  33. {
  34. $tpl->newBlock("new");
  35. $tpl->assign("titel", $title);
  36. }
  37. else
  38. {
  39. $tpl->newBlock("old");
  40. $tpl->assign("titel", $title);
  41. }
  42. }
  43.  
  44. $tpl->gotoBlock( "_ROOT" );
  45.  
  46. $tpl->printToScreen();
  47.  
  48. ?>
Offline CelestialCelebi - 13/05/2005 12:19
Avatar van CelestialCelebi PHP gevorderde Beetje omslachtig..

if ($left < FORUM_NEW)
{
$tpl->newBlock("new");
}
else
{
$tpl->newBlock("old");
}
$tpl->assign("titel", $title);
Offline robmoorman - 13/05/2005 12:40
Avatar van robmoorman PHP interesse ok het werkt, dank je
Gesponsorde links
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.212s