Re: [Phplib-users] Template.inc
Brought to you by:
nhruby,
richardarcher
|
From: Eric N. <nau...@ab...> - 2001-09-26 15:18:10
|
This solution is close to something I am Tring to figure out. The big =
difference is that in my case I am Tring to get it so that if there are no =
SUB_MENU entities the sub menu section is not displayed. From the way the =
example code works an empty SUB_MENU is produced even if there is no =
instance of the sub menu being generated. How would I work around this?
>>> "Layne Weathers" <la...@if...> 09/10/01 10:50AM >>>
> i need to use this kind of block in a template
>
> <!-- BEGIN MENU -->
> <tr>
> <td><a href=3D"{NAME_MENU}"><img src=3D"{IMG_MENU}"></a>
> </tr>
> <!-- BEGIN SUB_MENU -->
> <tr>
> <td><a href=3D"{NAME_SUB_MENU}"><img src=3D"{IMG_SUB_MENU}"></a>
> </tr>
> <!-- END SUB_MENU -->
> <!--END MENU -->
$tpl =3D new Template("../templates/");
$tpl->set_file("example", "example.tpl");
$tpl->set_block("example", "MENU");
$tpl->set_block("MENU", "SUB_MENU", "SUB_MENUS");
while( some loop that sets your variables ) {
$tpl->set_var(array("NAME_SUB_MENU" =3D> $name_sub_menu, "IMG_SUB_MENU"=
=3D>
$img_sub_menu));
$tpl->parse("SUB_MENUS", "SUB_MENU", true);
}
$tpl->pparse("example", array("MENU"));
Layne Weathers
Ifworld Inc
_______________________________________________
Phplib-users mailing list
Php...@li...
https://lists.sourceforge.net/lists/listinfo/phplib-users
|