RE: [phplib] set_block(): Please Help! From: layne <email protected>
Date: 07/27/00

> - book.ihtml -
> ...
> <tr>
> <!-- BEGIN info -->
> <td>{TITLE}
> <td>{CALLNO}
> <td>{AUTHOR}
> <!-- BEGIN option -->
> <td><input type="submit" name="cmd" value="{RENEW}">
> <td><input type="submit" name="cmd" value="More Details">
> <!-- END option -->
> <!-- END info -->
> </tr>

> +-------------------------------------------------------+
> | Title | Call No | Author |
> |
> +-------------------------------------------------------|
> |XXXX| XXXX | xxxx z | <Renew> | <More Info> |
> |YYYY| YYYY | ee xx | <Reserve> | <More Info> |
> +-------------------------------------------------------+

Just put the first header row in plain html inside book.ihtml - there is no
need to waste time with extra parses if the text of the header is not going
to change.
To do the templates with blocks...

$tpl->set_file("book", "book.ihtml");

$tpl->set_block("book", "option", "options");
$tpl->set_block("book", "info", "infos");

$db->query(<get book info>);
while($db->next_record()) {
  $tpl->set_var(array("TITLE" => $db->f(title), "CALLNO" => $db->f(callno),
etc.);
  $tpl->parse("options", "option", false);
  $tpl->parse("infos", "info", true);
}

Layne Weathers
Lead Programmer
Ifworld, Inc.
layne <email protected>

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