Re: Submenus

Simon Rönnqvist <[email protected]>
Newsgroups gmane.comp.cms.bitflux.general
Message-ID <[email protected]>
   Hi!

I'm coming back to this post, since I noticed that this could have  
been done in a slightly better, or at least more conventional way.

A more conventional way would be to not add an extra <li> for the  
submenu (as in my last suggestion) but to just insert an <ul> inside  
of the <li> in which the title of the submenu resides.

See comments below.

   cheers, Simon


On Oct 4, 2005, at 01:38, Simon Rönnqvist wrote:

> On Oct 3, 2005, at 20:01, Matthias Dieke wrote:
>
>> Simon Rönnqvist wrote:
>>
>>>   Hi!
>>> I guess your XSL could be useful... but I just found a little  
>>> flaw  which should be corrected.
>>> It's not correct to nest an <ul> directly inside of an <ul>, the   
>>> nested <ul> needs to be nested inside of an <li> just like in my   
>>> example.
>>> http://validator.w3.org/check?verbose=1&uri=http%3A//  
>>> www.nordicwalking-kiel.de/wissenswertes/
>>>
>>
>> Oh, not so good ;) It is possible that is a problem for all Flux  
>> CMS based sites... http://validator.w3.org/check? 
>> verbose=1&uri=http://www.bitflux.ch/produkte/cms/
>>
>> Also have some problems with "ul" and "li" :(
>
>   No problem, it's easily solved...
>
>> Here is my xsl-stuff for the navigation:
>>
>>     <xsl:template name="leftnavi">
>> <ul>
>>         <xsl:for-each select="$navitreePlugin/collection/items/ 
>> collection[display-order > 0]">
>>            <xsl:sort select="display-order" order="ascending" data- 
>> type="number"/>
>>
>>
>>
>>             <xsl:choose>
>>                 <xsl:when test="@relink">
>>                     <li><a href="{@relink}" target="_blank">
>>                         <xsl:value-of select="title"/>
>>                     </a></li>
>>                 </xsl:when>
>>                 <xsl:otherwise>
>>                   <li> <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></li>

   Move the </li> above to.... (Look for HERE!!! ;-)

>>                     <xsl:if test="@selected='selected'">
>
>
> Just add <li> before and </li> after the following line:

(And don't follow my previous instruction above. :-)

>>                           <xsl:apply-templates  
>> select="$navitreePlugin/collection/items/collection[@selected =  
>> 'selected']"/>
>>                     </xsl:if>

   HERE!!!
So that the <li> starts including the submenu (which is the <xsl:if  
test...> ... </xsl:if>).

>>                 </xsl:otherwise>
>>             </xsl:choose>
>>                 <!--<xsl:if test="position() != last()">|</xsl:if>-->
>>
>>
>>         </xsl:for-each>
>> </ul>
>>
>>     </xsl:template>
>>
>>
>> ----------
>>
>>
>> Uncomment all the the stuff between:
>>
>>   <xsl:template name="topnavi"> and </xsl:template> ;)
>
>   Yep...
> But I found that the leftnavi disappears when visiting the blog and  
> gallery pages, probably since they have leftnavis of their own in  
> their XSL-files. Does it override the master.xsl one? (I'm just  
> thinking since the topnavi still shows up on these pages (if not  
> commented out), and there's no topnavi in the blog.xsl and  
> gallery.xsl files.)
>
> Hmmm... then I just need to find a way to combine them...
>
> BTW. How did you get separate content in your topnavi and leftnavi  
> on the Nordic walking Kiel page? (I probably won't have that on my  
> page but, I'm just curious. ;-)
>
>> Would be cool if you find a solution for the validation-errors, I  
>> have not so much time for doing this job ;)
>
> Well, the only validation error that this caused was because of the  
> <ul> nested directly within an <ul> instead of an <li>, as I said  
> in the last mail... so now that's solved...
>
>   cheers, Simon
> PS. From one thing to another, leftnavi and topnavi aren't very  
> good names, since they aren't semantically picked; instead of  
> describing their content they describe their location which doesn't  
> really make sense since that's totally up to the CSS. Ie. I'm going  
> to have the leftnavi or topnavi (whichever I'd use) in the  
> righthand column, so I think I'm going to change the name.
>
>
>>> On Oct 3, 2005, at 19:39, Matthias Dieke wrote:
>>>
>>>> Hi,
>>>>
>>>> are you looking for something like that:
>>>>
>>>> http://www.nordicwalking-kiel.de/wissenswertes/ ???
>>>>
>>>>
>>>> If so I can send you the xsl.
>>>>
>>>> Matthias
>>>>
>>>>
>>>>>>>
>>>>>>> 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
>>>>>
>>>>>
>>>>
>>>> -- 
>>>> bitflux-cms mailing list
>>>> [email protected]
>>>> http://lists.bitflux.ch/cgi-bin/listinfo/bitflux-cms
>>>>
>>
>
> -- 
> bitflux-cms mailing list
> [email protected]
> http://lists.bitflux.ch/cgi-bin/listinfo/bitflux-cms

-- 
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.