Date: 11/16/00
- Next message: o.cook <email protected>: "RE: [phplib] Template Class Problem"
- Previous message: Don Undeen: "[phplib] " Unable to initialize new token cache in session.inc " error message"
- Next in thread: o.cook <email protected>: "RE: [phplib] Template Class Problem"
- Maybe reply: o.cook <email protected>: "RE: [phplib] Template Class Problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I am trying to do some development with the Template class in phplib7.2b
(downloaded today). I am following the example at:
http://phplib.netuse.de/documentation/documentation-4.html#ss4.2
First off; this is the code I am using:
in box.ihtml:
<!-- start box.ihtml -->
<table border=1 bgcolor="#cccccc" cellpadding=4 cellspacing=0>
<tr>
<td colspan=2><b>{TITLE}</b></td>
</tr>
<!-- BEGIN row -->
<tr>
<td>{NUM}</td>
<td>{BIGNUM}
</tr>
<!-- END row -->
</table>
<!-- end box.ihtml -->
in page.ihtml:
<html>
<head><title>{PAGETITLE}</title></head>
<body bgcolor="#ffffff">
<table border=1 cellpadding=4 cellspacing=0 bgcolor="#eeeeee">
<tr>
<td colspan=2><h1>{PAGETITLE}</h1></td>
</tr>
<tr>
<td>{out}</td>
<td>Content</td>
</tr>
</table>
</body>
</html>
in test.php:
<?php
include("/home/ollie/devel/public_html/phplib-7.2b/php/template.inc");
# create Template instance called $t
$t = new 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<=15; $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("out", array("box", "page"));
# finish out and print it.
$t->p("out");
?>
<hr>
<?php
# report leftover variables, if any.
#print implode(", ", $t->get_undefined("rows"));
?>
With that out of the way; I am getting the following output from test.php
(http://devel.zenox.dhs.org/test/test.php)
<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><!-- start box.ihtml -->
<table border=1 bgcolor="#cccccc" cellpadding=4 cellspacing=0>
<tr>
<td colspan=2><b>Testpage</b></td>
</tr>
rows
</table>
<!-- end box.ihtml -->
</td>
<td>Content</td>
</tr>
</table>
</body>
</html>
<hr>
As you can see, instead of showing the rows of the table, it is just
printing the literal string "rows".
I am running Apache with PHP compiled in as a module ("Apache/1.3.12 (Unix)
PHP/4.0.3pl1")
Any reasons why that should be? I've copied the example source verbatim.
Regards,
Ollie
--- Optimist: "The glass if half full" Pessimist: "The glass is half empty" Engineer: "The glass is twice as large as it needs to be" http://pgpkeys.mit.edu:11371/pks/lookup?op=get&search=0x53D29567 ------------------------------------------------------------------------ To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>
- Next message: o.cook <email protected>: "RE: [phplib] Template Class Problem"
- Previous message: Don Undeen: "[phplib] " Unable to initialize new token cache in session.inc " error message"
- Next in thread: o.cook <email protected>: "RE: [phplib] Template Class Problem"
- Maybe reply: o.cook <email protected>: "RE: [phplib] Template Class Problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

