Hi Antony,

I followed your suggestion and it works. 
I paste the code snippet in case someone else needs it.

{{                                                                             

smenu = mmenu.serialize(mmenu.data)
mmenu = MENU(response.menu, _class='nav' )
lis = 
smenu.elements('li.web2py-menu-expand')                                  
for i in lis: i[0] = H4(i[0].flatten(), 
_class="mfoot")                        
=smenu                                                                         

}} 

Everything is in the main layout view, after, I will think where is the 
best place to manipulate the footer menu,
I do not want to put much python code in a view.

In the trunk web2py version at Revision: 17a0b1bbf2f6 (rif *)
I saw that Massimo added empty components in the MENU helper constructor,
this solve my first post traceback but your workaround is needed yet.

Many thanks both

AP


(rif *) 
http://code.google.com/p/web2py/source/detail?r=17a0b1bbf2f691edecdd90adbeb6777e7ff1e7c6
   



Il giorno martedì 11 settembre 2012 17:29:02 UTC+2, Anthony ha scritto:
>
> Looks like MENU doesn't generate a DOM structure until its .serialize() 
> method is called. You could do:
>
> mmenu = mmenu.serialize(mmenu.data)
> mmenu.elements('a')
>
> I'm not sure why it was done this way as opposed to generating the DOM 
> upon initialization. Massimo?
>
> Anthony
>
> On Tuesday, September 11, 2012 10:49:59 AM UTC-4, amphisia pui wrote:
>>
>> Hi to all 
>>
>> I want to use the html helper MENU to have in the page footer a menu 
>> totally exploded without sliding items.
>> I changed the css classes and everything looks fine but I don't want the 
>> first level menu items to be clickable
>>
>>  so the first thing I tried was the server-side parsing to remove 
>> unnecessary tags but in a web2py shell I got
>>
>> mlist = ... well formatted web2py menu list
>>
>> In [40]: mmenu = MENU(mlist)
>>
>>  In [41]: mitems = mmenu.elements('a')
>>
>> ---------------------------------------------------------------------------
>> AttributeError                            Traceback (most recent call 
>> last)
>> /opt/web2py/applications/happy/models/menu.py in <module>()
>> ----> 1 mmenu.elements('a')
>>
>> /opt/web2py/gluon/html.pyc in elements(self, *args, **kargs)
>>    1079         # loop the components
>>
>>    1080         if find_text or find_components:
>> -> 1081             for i, c in enumerate(self.components):
>>    1082                 if check and find_text and isinstance(c, str) and 
>> \
>>    1083                    ((is_regex and find_text.search(c)) or 
>> (str(find_text) in c)):
>>
>> AttributeError: 'MENU' object has no attribute 'components'
>>
>> Is MENU helper supposed to work with sever side DOM parsing? Is web2py 
>> ipython Shell fault?   
>> Can you suggest something better to try to have first level items menu 
>> seem like simple labels?
>>
>> Thanks to all
>>
>> AP
>>
>> Sys info
>> Python 2.7.3
>> web2py 2.0.8
>>
>>

-- 



Reply via email to