[phplib] template prob with phplib and php4 From: Peter Niederlag (Peter <email protected>)
Date: 03/13/01

already posted this in german, forgive my ignorance ;-(

I try to pick up on phplib by using example code(page.ihtml, box.ihtml
and index.php3) from the included documentation-4.html#ss4.2
(Apache 1.3.14/win;PHP4.0.4pl1/phplib-7.2c)

I get this error-report:

Warning: Bad arguments to implode() in
c:/apache/htdocs/testing/index.php3 on line 42

for using:

<?php
  include("template.inc");

  # create Template instance called $t
  $t = new Template("c:/apache/htdocs/testing/template", "keep");

  # define variables named page and box, referencing files
  $t->set_file(array(
     "page" => "page.ihtml",
     "box" => "box.ihtml"));

  # extract the block named "row" from "box", creating a
  # reference to {rows} in "box".
  $t->set_block("box", "row", "rows");

  # define the variables TITLE and PAGETITLE
  $t->set_var(array("TITLE" => "Testpage",
                    "PAGETITLE" => "hugo" ));

  # define NUM and BIGNUM, then append "row" to "rows"...
   for ($i=1; $i<=3; $i++) {
    $n = $i;
    $nn = $i*10;
    $t->set_var(array("NUM" => $n, "BIGNUM" => $nn));
    $t->parse("rows", "row", true);
  }

  # build out from box, then build out from page...
  $t->parse("test", array("box", "page"));

  # finish out and print it.
  #$t->p("out");
  $t->p("test");
?>
<hr>
<?php
  # report leftover variables, if any.
  print implode(", ", $t->get_undefined("rows"));
 ?>

the complete output file is:

<html>
 <head><title>hugo</title></head>
 <body bgcolor="#ffffff">
 <table border=1 cellpadding=4 cellspacing=0 bgcolor="#eeeeee">
  <tr>
   <td colspan=2><h1>hugo</h1></td>
  </tr>
  <tr>
   <td>{OUT}</td>
   <td>Content</td>
  </tr>
 </table>
 </body>
</html>

<hr>
<br>
<b>Warning</b>: Bad arguments to implode() in
<b>c:/apache/htdocs/testing/index.php3</b> on line <b>42</b><br>

does anybody out there have a hint?
Thx, Peter

--
Peter Niederlag

--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>