Re: Submenus

Simon Rönnqvist <[email protected]>
Newsgroups gmane.comp.cms.bitflux.general
Message-ID <[email protected]>
On Oct 3, 2005, at 15:47, Christian Stocker wrote:

>
>
> On 3.10.2005 1:31 Uhr, Simon Rönnqvist wrote:
>
>>   Hi!
>>
>> I modified the menu a bit and made it an unordered list <ul> in the
>> sidebar. http://strengsong.com Now I'd think it'd be really nice   
>> being
>> able to have submenus, which in the XHTML would mean nested   
>> unordered
>> lists. Do you have any suggestions on how this could be   
>> achieved?  (To
>> see some fun examples of what you can do with nested  <ul> menus  
>> visit:
>> http://www.meyerweb.com/eric/css/edge/menus/ demo.html )
>>
>> I guess one could do this in the same way as Chregu recently   
>> explained
>> how to make multilingual site descriptions. http://
>> lists.bitflux.ch/pipermail/bitflux-cms/2005-September/001577.html
>> But that would also make the menu kind of static, or let's say not
>> really easy enough to edit for the average customer.
>>
>
> Nono, the solution is much easier. Look at themes/mobile/master.xsl  
> and
> search for
>
> <xsl:template name="topnavi">
>
> It should do exactly what you want, so you can use that code for your
> template.
>
> chregu


   Hi!

If I understood the mobile example correctly it doesn't actually  
produce submenus, or in other words doesn't produce nested unordered  
lists.

I'll clarify what I was looking for...
I kind of already did something like the mobile example at http:// 
strengsong.com by editing the 2-col master.xsl like this (I basically  
just inserted <ul> and <li> tags):

                     <ul id="topnavi">
                         <xsl:call-template name="topnavi"/>
                     </ul>
...
         <xsl:template name="topnavi">

         <xsl:for-each select="$navitreePlugin/collection/items/ 
collection[display-order != 0]">
             <xsl:sort select="display-order" order="ascending" data- 
type="number"/>
             <li><xsl:choose>
                 <xsl:when test="@relink">

                     <a href="{@relink}">
                         <xsl:value-of select="title"/>
                     </a>
                 </xsl:when>
                 <xsl:otherwise>
                     <a href="{$webrootLang}{substring-after(uri,'/')}">
                         <xsl:if test="@selected='selected'">
                             <xsl:attribute name="class">selected</ 
xsl:attribute>

                         </xsl:if>
                         <xsl:value-of select="title"/>
                     </a>
                 </xsl:otherwise>
             </xsl:choose></li>
                 <!--<xsl:if test="position() != last()">|</xsl:if>-->
         </xsl:for-each>
     </xsl:template>



But what this does is to produce just an ordinary <ul> menu... what I  
was looking for is a possibility to make submenus, that is nested  
<ul>:s.
Ie.
<ul>
   <li><a href="/">Home<a/></li>
   <li><a href="/something">Something</a></li>
   <li><a href="/submenu">Submenu</a>
     <ul>
       <li><a href="/submenu/submenuitem">Submenuitem</a></li>
       <li><a href="/submenui/another_submenuitem">Another  
submenuitem</a></li>
     </ul>
   <li>Yet another non sub-menuitem</li>
   <li>Another kind of submenu (without a linked title)
     <ul>
       <li><a href="/anothersubmenuitem/">Anoher submenu item</a></li>
       <li><a href="/othersubmenu/item">Or yet another kind of  
submenu item</a></li>
</ul>

   cheers, Simon-- 
bitflux-cms mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bitflux-cms
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.