Re: [PHPTAL] Best way to make a list of list

2008-08-09 Thread Guillaume Lecanu
Hi,

I have just tried your example.

Here is my list attached to PHPTAL :

$tpl-set('listmenu', array(
array('title' = 'First', 'submenu' = null),
array('title' = 'Second', 'submenu' = array(
array('title' = 'Youp', 'submenu' = null),
)),
array('title' = 'Third', 'submenu' = null),
));


If I try to show the first level menus (first, second, third) this works
fine with this code :

tal:block tal:repeat=item listmenu
lia href=# tal:replace=item/titleTitle/a/li
/tal:block


But if I try your example (I have adapted a little bit) this doesn't
works :

ul metal:define-macro=makemenu
tal:condition=listmenu
li tal:repeat=item listmenu
a href=# tal:replace=item/titleTitle/a
tal:block metal:use-macro=makemenu
tal:define=listmenu item/submenu /
/li
/ul

Any ideas ?

Thanks a lots.


Le vendredi 08 août 2008 à 22:46 +0200, Guillaume Lecanu a écrit :

 Le vendredi 08 août 2008 à 17:24 +0100, Kornel Lesiński a écrit : 
 
  On 08-08-2008 at 17:18:31 Guillaume Lecanu [EMAIL PROTECTED] wrote:
  
   But all the structure is stored in DB, so I don't know in advance if one
   menu have 1, 2, or 10 childrens, and I don't know if a children is a
   submenu.
  
   I know how to do that in PHP without PHPTAL, but how is it possible to
   do that kind of XHTML code with PHPTAL ?
  
  Of course. You can use macros called recursively:
  
  ul metal:define-macro=list tal:condition=list
  li tal:repeat=item list...
  tal:block metal:use-macro=list tal:define=list 
  item/sublist /
  /li
  /ul
 
 Interresting, I'll try this.
 
 
 Thanks Kornel  Iván
 
 
 ___
 PHPTAL mailing list
 PHPTAL@lists.motion-twin.com
 http://lists.motion-twin.com/mailman/listinfo/phptal
___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] Best way to make a list of list

2008-08-08 Thread Kornel Lesiński

On 08-08-2008 at 17:18:31 Guillaume Lecanu [EMAIL PROTECTED] wrote:


But all the structure is stored in DB, so I don't know in advance if one
menu have 1, 2, or 10 childrens, and I don't know if a children is a
submenu.

I know how to do that in PHP without PHPTAL, but how is it possible to
do that kind of XHTML code with PHPTAL ?


Of course. You can use macros called recursively:

ul metal:define-macro=list tal:condition=list
li tal:repeat=item list...
tal:block metal:use-macro=list tal:define=list item/sublist 
/
/li
/ul

--
regards, Kornel

___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal


Re: [PHPTAL] Best way to make a list of list

2008-08-08 Thread Iván -DrSlump- Montes
I think the only way to do nested structures with PHPTAL is using
Metal's macros. Have you looked at it?

Iván

On Fri, Aug 8, 2008 at 6:18 PM, Guillaume Lecanu [EMAIL PROTECTED] wrote:
 Hello,

 I need to make a menu, with some sub-menus and other sub-menus etc.

 For example :

 * Menu A :
* A1
* A2
* Hello
* World
* A3
 * Menu B
* B1
   * PHPTAL
   * Rocks !
* B2

 So in XHTML this is list of ul:

 ul
liMenu A
ul
liA1/li
liA2
   ul
  liHello/li
  liWorld/li
/ul
 /li
liA3/li
/ul
/li
liMenu B
 
 /li


 But all the structure is stored in DB, so I don't know in advance if one
 menu have 1, 2, or 10 childrens, and I don't know if a children is a
 submenu.

 I know how to do that in PHP without PHPTAL, but how is it possible to do
 that kind of XHTML code with PHPTAL ?

 Thanks a lots for your help.
 ___
 PHPTAL mailing list
 PHPTAL@lists.motion-twin.com
 http://lists.motion-twin.com/mailman/listinfo/phptal



___
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal