login  Naam:   Wachtwoord: 
Registreer je!
 Forum

TemplatePower en classes

Offline Slipie - 30/11/2005 00:13
Avatar van SlipiePHP beginner Heej allemaal,

Ik heb een probleempje bij het gebruiken van templatepower.
Als ik m'n output uit een class haal dan word de output helemaal bovenaan de pagina weergegeven.

dit is m'n template:
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <title>Forum</title>
  5. </head>
  6. <body>
  7. <table border="1">
  8. <tr>
  9. <td>Forum</td>
  10. <td>Topics</td>
  11. <td>Messages</td>
  12. <td>Last Message</td>
  13. </tr>
  14. {cat_index}
  15. </table>
  16. </body>
  17. </html>


En dit is m'n php source:
  1. <?
  2. mysql_connect("localhost", "user", "pass");
  3. include('../template/class.TemplatePower.inc.php');
  4. class Show_index {
  5. function table() {
  6. $q_index = mysql_query("SELECT name FROM forum_index ORDER BY id") or die(mysql_error());
  7. while($op_index = mysql_fetch_array($q_index)) {
  8. echo "<tr>";
  9. echo "<td>" . $op_index['name'] . "</td>";
  10. echo "</tr>";
  11. }
  12. }
  13. }
  14.  
  15. $Show_index = new Show_index;
  16.  
  17. $tpl = new Templatepower("forum_index.tpl");
  18. $tpl->prepare();
  19.  
  20. $tpl->assign("cat_index", $Show_index->table());
  21.  
  22. $tpl->printToScreen();
  23. ?>


Kan iemand misschien zien wat ik hier fout doe?
Ik heb het probleem niet als ik de output van de class gewoon intyp.

Dus als ik dit doe:
  1. $tpl->assign("cat_index", "<tr><td>bla</td></tr>");

0 antwoorden

Gesponsorde links
Er zijn nog geen reacties op dit bericht.
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.189s