Re: Template-trouble

Yuri Smetsers <[email protected]>
Newsgroups gmane.comp.web.zope.silva.devel
Message-ID <[email protected]>
Hi Clemens,

> I admit I did not understand where the eight and ninth argument to the oM.makeMenu came from [...]
As following:

oM.makeMenu(name, parent_name, text, link, target, width, height, regImage, overImage, regClass, overClass , align, rows, nolink, onclick, onmouseover, onmouseout)

> Chances are high this is not the way to do it, but I hope You can figure out the right way to do it
For now, I'll have to use my own (sloppy) version - due to the lack of time and (mostly) Python programming skills. ;)
I'm sure to have a look at it later.

Thanks for your time. :)

Regards,
Yuri Smetsers


Clemens Robbenhaar wrote:

>Hi Yuri,
>
> > Hi Clemens,
> > 
> >  >>Hm, I have never heard about this CoolMenus stuff ... however
> >  >>if You want to filter for non-empty folders,
> >  >> You maybe could use the "is_published" method [ ... ]
> > The method works fine, thanks.
> > However, combining "is_published" with Coolmenu's Javascript puzzles me.
> > 
> > I managed to get it working, but it looks very sloppy:
> > 
> > [snip[
> > 
> > <script tal:condition="here/portfolio/is_published">
> > oM.makeMenu('portfolio','','','/twin/portfolio/','',83,16,'/twin/images/nav/hoofdmenu/03_portfolio.gif','/twin/images/nav/hoofdmenu/03_portfolio_mo.gif','','','top')
> > </script>
> > <script tal:condition="here/opdrachtgevers/is_published">
> > oM.makeMenu('opdrachtgevers','','','/twin/opdrachtgevers/','',122,16,'/twin/images/nav/hoofdmenu/04_opdrachtgevers.gif','/twin/images/nav/hoofdmenu/04_opdrachtgevers_mo.gif','','','top')
> > </script>
> > <script tal:condition="here/contact/is_published">
> > oM.makeMenu('contact','','','/twin/contact/','',75,16,'/twin/images/nav/hoofdmenu/05_contact.gif','/twin/images/nav/hoofdmenu/05_contact_mo.gif','','','top')
> > </script>
> > 
> > [/snip]
> > 
>
> I guess its more a problem with page templates treating scripts badly.
>For some reasons page templates do ignore tal:-expressions inside
><script>-tags intentionally. This is a design decision made too long ago
>to discuss its pros and cons thus I do not do it here.
>
> The work around I use in this case is including a python script, which
>does the rendering code. In Your case this may look like:
>
><script_dummy tal:replace="strcuture here/get_js_stuff" />
>
>in the layout macro.
>
> Beside this in the Silva Root put a python script "get_js_stuff"
>which does something like:
>
>rendered = []
>for content in context.get_ordered_publishables():
>   if not content.is_published():
>      continue
>
>   rendered.append('<script type="text/javascript">')
>   rendered,append("""
>oM.makeMenu('%s','','','%s/','',83,16,'/twin/images/nav/hoofdmenu/%s','/twin/images/nav/hoofdmenu/%s','','','top')
>""" % (content.getId(), contenbt.absolute_url(),
>        container.get_image_id(content),
>        container.get_image_id2(content)
>      )
>   rendered.append('</script>')
>
>return '\n'.join(rendered)
>
>
>I admit I did not understand where the eight and ninth argument to the
>oM.makeMenu came from, thus I replaced them with calls to two more, yet
>to be written scripts, "get_image_id" and "get_image_id2". For example
>"get_image_id(portfolio)" should return "03_portfolio.gif", while
>"get_image_id(opdrachtgevers)" should return "04_opdrachtgevers.gif".
>
> Chances are high this is not the way to do it, but I hope You can
>figure out the right way to do it.
>
> The usual disclaimer: Everything untested and modulo a lot of typos.
>
>Cheers,
>Clemens
>
>  
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.