Re: [Phplib-users] OOH & Template
Brought to you by:
nhruby,
richardarcher
|
From: Mike G. <Mik...@sa...> - 2002-03-09 19:27:22
|
If your template, jane_fred.tpl located in ./templates, were to look
something like
<html>
<head>
<title>Template and Form Test</title>
</head>
<body>
<!-- BEGIN jane_fred_template -->
<form>
Template and Form Test<br>
{JANE} {FRED}
</form>
<!-- END jane_fred_template -->
</body>
</html>
Then something like the following should work to populate the template:
<?php
$jane =3D 'Hello';
$fred =3D 'World';
$f =3D new form;
$f->add_element(array("type" =3D> "text",
"name" =3D> "fred",
"size" =3D> "10",
"value" =3D> $fred));
$f->add_element(array("type" =3D> "text",
"name" =3D> "jane",
"size" =3D> "10",
"value" =3D> $jane));
$element_names =3D array_keys($f->elements);
foreach($element_names as $key) {
$var_array[strtoupper($key)] =3D $f->get_element($key);
}
$tpl =3D new Template("./templates");
$tpl->set_file(array("jane_fred_file" =3D> "jane_fred.tpl"));
$tpl->set_block("jane_fred_file", "jane_fred_template", "jane_fred");
$tpl->set_var($var_array);
$tpl->parse("jane_fred", "jane_fred_template");
$tpl->pparse("output", "jane_fred_file");
?>
Cheers!
Mike Green
Matthias Gr=F6schl wrote:
> HI,
>
> are there some examples around for OOH Form together with Templates.
>
> I found a tutorial about OOH and another for Template, but get them
> together is not quiet simple ;-)
>
> Thx
> Matthias
>
> _______________________________________________
> Phplib-users mailing list
> Php...@li...
> https://lists.sourceforge.net/lists/listinfo/phplib-users
--
Mike Green
SaeSolved::
http://www.saesolved.com
http://www.everypeople.net
http://www.sitewidgets.com
http://www.widgetchuck.com
|