Re: Hrm... stumped.
| From: | Sylvain Bergé | Date: | Tue, 13 Mar 2001 09:45:12 +0000 |
| Subject: | Re: Hrm... stumped. | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-383@lists.php.net to get a copy of this message | ||
I am very interested too by this subject. I just starts to work with DOM XML to generate menu.
I use smarty engine and an other project very interesting too : phpDOM : http://devil.medialab.at/projects/phpdom/doc/phpDOM.html
I build a portal, there are a XML file into each directory for generate menu of the main pages into this directory :
Tree structure :
.
..
folder1
folder2
folder3
index.html
file1.html
file2.html
file3.html
menu.xml
the menu is the same for : file1.html, file2.html, file3.html
-- menu.xml :
<menu lang="fr" titre="my menu">
(...) <item type="link">
<name>my text</name>
<target>folder1/page22.html</target>
<style>bold</style>
<position>tab</position>
</item>
(...)
<item type="text">
<name>my text2</name>
<style>normal</style>
<position>normal</position>
</item>
(...)
</menu>
You keep this data into an array and you use template to interpret the data and generate the menu.
I miss only the means of exploring the tree structure to recover all the files in the order and to generate an general index.
Otherwise, I remember that a PHP class exist on the PHPLib too.
Regards
Sylvain.B.
Alexander, Jason wrote:
Hey all, I've got myself stumped here, and I wanted to see if anyone else can help me out, perhaps. I'm attempting to write a hierarchical explorer-like view with Smarty, and I'm having some issues. Given the following dataset: ID SUBJECT PARENT_ID ---------------------------------------------------------- 1 Test1 0 2 Test2 1 3 Test3 2 4 Test4 0 5 Test5 4 6 Test6 4 I'm wanting to create something like: + Test1 + Test2 + Test3 + Test4 + Test5 + Test6 Normally, I can handle this recursive by first grabbing the parent items, and then recursing down the childs, query for it's childs along the way. But, with Smarty I've happened across an interesting predicament, because (if I'm correct) I need to be able to preload a datastructure in a manageable format that I'm able to script out the layout in the template. I appreciate the help! TIA, -Jason --- You are currently subscribed to smarty as: sylvain.berge@medasys.fr To unsubscribe send a blank email to $subst('Email.Unsub') Visit Smarty's homepage at http://www.phpinsider.com/php/code/Smarty//* In a world without walls and borders, who needs windows and gates ? */