Date: 03/01/01
- Next message: Kartic Krishnamurthy: "Re: [phplib] set_block/documentation"
- Previous message: Kristian Koehntopp: "Re: [phplib] phplib website"
- Next in thread: Kartic Krishnamurthy: "Re: [phplib] set_block/documentation"
- Reply: Kartic Krishnamurthy: "Re: [phplib] set_block/documentation"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I have been trying real hard to get the set_block function from the
template class to work.
I am still using the examples from the included documentation (7-2c) ,
read the archive already thoroughly, tried out quite a little bit with
preg_regplace but none would help. Since you are talking about 7-2d
release i think it would be great to maybe solve this problem.
It makes me crazy. template.php3 will execute but the {out} block will
be just a {out} in HTML output.
I really appreciate your help.
Thx, Peter (using php4.0.4 on w98 with apache mod_php)
#########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>
########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 -->
#####template.php3
<?php
include("template.inc");
# create Template instance called $t
$t = new Template("c:/apache/htdocs/testing/template",
"comments");
# 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("out", array("box", "page"));
# finish out and print it.
$t->p("out");
?>
<hr>
<?php
# report leftover variables, if any.
print "undefiniert: ".implode(", ", $t->get_undefined("out"));
?>
-- Peter Niederlag--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>
- Next message: Kartic Krishnamurthy: "Re: [phplib] set_block/documentation"
- Previous message: Kristian Koehntopp: "Re: [phplib] phplib website"
- Next in thread: Kartic Krishnamurthy: "Re: [phplib] set_block/documentation"
- Reply: Kartic Krishnamurthy: "Re: [phplib] set_block/documentation"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

