Date: 10/03/00
- Next message: Alexander Aulbach: "Re: [phplib-dev] cvs commit"
- Previous message: ssilk: "[phplib-dev] cvs commit"
- Next in thread: Alexander Aulbach: "Re: [phplib-dev] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: ssilk
Date: Wed Oct 4 03:57:17 2000
Added files:
php-lib/php/ext/tree_template.inc
Log message:
This class will help you to output trees in HTML.
The surrounding principle is the same in the class Tree. If you want
to know how this works, please read the docs about this.
But this class is a complete rewrite of Tree and it extends Template.
How to use it?
Define a template like follows:
---------------------------------------------------------------------
!-- BEGIN tree_start -->
<ul> Tree starting with {num} elements:
<!-- END tree_start -->
<!-- BEGIN tree_down -->
<ul> Element {u_name} has {num} sub-element(s):
<!-- END tree_down -->
<!-- BEGIN tree_leaf -->
<li> {cnt}/{num}: <a href="{phpself}?pk={pk}">{name}</a>
PK: {pk} Path: {path}
<!-- END tree_leaf -->
<!-- BEGIN tree_up -->
</ul>
<!-- END tree_up -->
<!-- BEGIN tree_end -->
</ul>
<!-- END tree_end -->
---------------------------------------------------------------------
[note: {phpself} must be set by yourself,
{cnt} and {num} are set by the program
{name}, {pk} and {path} are values in tval-Array
{u_name}, {u_pk}, {u_path} are values from the parent tval-Array]
In your program create a class like follows:
---
$t=new Tree_Template('templates/tree.html.tpl','.','remove');
---
Set the tree and tree-data:
---
$tr->tree_select(Array());
# Tree_SQL produces the needed values in the format Tree_Template needs it
$t->set_tree($tr->tree,$tr->tval);
---
($tr->tree and $tr->tval are produced within the functin tree_select()
of the class Tree_SQL! Please look inside of Tree_Template for the format
it uses!)
Output the tree
---
$t->tree_output();
$t->p('tree');
---
Thats all. :-)
---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-dev-unsubscribe <email protected>
For additional commands, e-mail: phplib-dev-help <email protected>
- Next message: Alexander Aulbach: "Re: [phplib-dev] cvs commit"
- Previous message: ssilk: "[phplib-dev] cvs commit"
- Next in thread: Alexander Aulbach: "Re: [phplib-dev] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

