Click here to register.
      
irc://irc.freenode.net#webgui

iPhoneGuy: WebGUI is a pile of crap.
rizen: If WebGUI is such a pile of crap, why do you use it?
iPhoneGuy: Because it's the best pile of crap out there.

If this is what people who hate us are saying, imagine what people who love us will say. Come join us on IRC.


     Discuss > Web Design, Templates, and Themes Goto page «Previous Page   1 2    Next Page»

Navigation Unordered List (XHTML STRICT)

User artiswork
Date 2/22/2007 11:30 am
Views 4192
Rating 6    Rate [
|
]
Previous · Next
User Message
artiswork

Anyone have any pointers about how to get an unordered list with multiple levels to work?

Our current template is:

<ul class="indentedNav">
<tmpl_loop page_loop>
        <li class="level<tmpl_var page.relDepth>">
            <a href="<tmpl_var page.url>">
            <tmpl_if page.isCurrent>
        <span class="selectedMenu"><tmpl_var page.menuTitle></span>
    <tmpl_else><tmpl_var page.menuTitle></tmpl_if>
            </a>
        </li>
</tmpl_loop>
</ul>

 This won't be truly semantic though, as the list elements at level 2 won't be children of the navigation element ahead of them.

Thanks,

Matthew

--- (Edited on 2/22/2007 11:30 am [GMT-0600] by artiswork) ---



Back to Top
Rate [
|
]
 
 
colink

I did a quick search in this forum for "unordered list" and came across a discussion from 2005 about this very thing.

http://www.plainblack.com/web_design_templates_and_themes/trouble-with-navigation-template#kKNUZqBiyjhYxsKwZomn4g

Strangely, some of the posts seem to be missing, but the posts that have been preserved still contain some useful info.

Check it out, and do some more digging in the boards.  I know this exact problem has been asked before, so there should be a ready solution for it. 

 

--- (Edited on 2/22/2007 2:05 pm [GMT-0600] by colink) ---



Back to Top
Rate [
|
]
 
 
philadev

Without touching on the template logic building a valid nesting unordered list works pretty simply.

<ul class="indentedNav">
     <li><a>Element 1</a>
           <ul>
                 <li><a>Nested Element 1<a/></li>
                 <li><a>Nested Element 2</a></li>
            </ul>
    </li>
    <li><a>Element 2</a></li>
</ul>

For it to validate xhtml 1.0 strict you just need to have the nested UL inside the LI.

Then you can access it through the descendant selector:

.indentedNav li {#style info#}

.indentedNav li ul li {#style info#}

And so on. Though that does get sticky as the second rule will be applied to all list items from the second level on. You can fix that with continuing levels of specificity or through the typical id or class means.

I may have a good example of a tiered navigation template logic but it's from 6.7 and won't validate but it could be a good start. Just let me know if that would help and I'll post it. 

--- (Edited on 2/22/2007 3:46 pm [GMT-0600] by philadev) ---



Back to Top
Rate [
|
]
 
 
artiswork
Philadev, yep. know how to make a valid ul :), I just need the template logic. I'd prefer valid. I'll have to keep looking.

--- (Edited on 2/22/2007 4:16 pm [GMT-0600] by artiswork) ---



Back to Top
Rate [
|
]
 
 
philadev

Try this out. It's pretty close.

----------------- 

<tmpl_if session.var.adminOn>
<tmpl_var controls><br />
</tmpl_if>

<tmpl_if displayTitle>
    <h2><tmpl_var title></h2>
</tmpl_if>
<tmpl_if description>
    <p><tmpl_var description></p>
</tmpl_if>

<tmpl_loop page_loop>

<tmpl_if __FIRST__>
    <tmpl_loop page_loop>
        <tmpl_loop page.depthDiff_loop>
        </li></ul>
            <tmpl_if __last__>
            </li>
            </tmpl_if>
        </tmpl_loop>

    <tmpl_if Page.isRankedFirst>
    <ul>
    </tmpl_if>
   
    <li>
    <tmpl_var page.menuTitle>

        <tmpl_unless page.hasChild>
            <tmpl_unless page.isRankedLast>
            </li>
            </tmpl_unless>
        </tmpl_unless>

        <tmpl_if __LAST__>
            <tmpl_loop page.indent_loop>
            </li>
            </ul>
            </tmpl_loop>
        </tmpl_if>

    </tmpl_loop>
</tmpl_if>

<tmpl_if __FIRST__>
    <tmpl_if page.relativeDepthIs0>
    </li></ul>
    </tmpl_if>
</tmpl_if>

</tmpl_loop>

-------------

I got a real good start from the post below and made a few edits to get it to nest properly:

http://www.plainblack.com/webgui/dev/discuss/unordered-list-with-navigation-template?pn=3

It's almost perfect with one small problem leaving off an </li> in the middle as below at Media, About Us and Procedures & Policies.

 

<h2>Semantic Nav Test</h2>
<ul>
    <li> Department of Example
        <ul>
            <li> Images
                <ul>
                    <li> stylemanager
                        <ul>
                            <li> Logo </li>
                            <li> Banner </li>
                        </ul>
                    </li>
                </ul>
            </li>
            <li> Documents </li>
            <li> Media
            <li> About us
            <li> Contact Us </li>
            <li> Programs & Services
                <ul>
                    <li> Qwer Tyui Opas dfgh jklz xcvb nm </li>
                </ul>
            </li>
            <li> Procedures & Policies
            <li> Forms </li>
            <li> FAQs
                <ul>
                    <li> Questions Group Title </li>
                </ul>
            </li>
            <li> Settings </li>
            <li> Staging </li>
        </ul>
    </li>
</ul>

 

 

--- (Edited on 2/23/2007 11:42 am [GMT-0600] by philadev) ---



Back to Top
Rate [
|
]
 
 
artiswork
I am amazed that such a large CMS with so many conditional tags and outputs can't produce a clean XHTML ul list. I have searched high and low without solid results. Thanks for your help philadev. Matthew

--- (Edited on 3/ 1/2007 7:42 am [GMT-0600] by artiswork) ---



Back to Top
Rate [
|
]
 
 
JT

You do understand what you're doing right, and why this is a difficult problem? You have a flat array of data, that you want to turn into a hierarchical structure.

It is possible to do it. Just not easy.

I'll have our design guy explain how. 

--- (Edited on March 1, 2007 9:36 am [GMT-0600] by JT) ---



Back to Top
Rate [
|
]
 
 
artiswork
JT, That would be outstanding. I've asked our client when we might be upgrading to 7+ which apparently makes this easier? But for the meantime, this is what we're working with. I appreciate the response.

--- (Edited on 3/ 1/2007 9:55 am [GMT-0600] by artiswork) ---



Back to Top
Rate [
|
]
 
 
JT
I didn't realize you weren't on 7. I can't help you.

--- (Edited on March 1, 2007 9:58 am [GMT-0600] by JT) ---



Back to Top
Rate [
|
]
 
 
artiswork
JT, if you're willing to post the information anyhow, I'd appreciate it as we will be upgrading shortly. Thank you.

--- (Edited on 3/ 1/2007 10:43 am [GMT-0600] by artiswork) ---



Back to Top
Rate [
|
]
 
 
     Discuss > Web Design, Templates, and Themes Goto page «Previous Page   1 2    Next Page»




Re: WRE upgrade 0.8.3 to 0.8.4 issue by koen - Thu @ 02:18pm

Re: "No Upgrade Necessary" by pvanthony - Thu @ 12:41pm

Re: WRE upgrade 0.8.3 to 0.8.4 issue by jmack - Thu @ 12:37pm

Installed WebGUI on SuSE 10.1 64bit by crythias - Thu @ 09:20am

Re: Question to Spectre by JT - Thu @ 06:40am

Question to Spectre by bepo - Thu @ 06:29am

Re: Re-design of "Get Add Ons" section by Chirifischio - Thu @ 05:45am

Re: "No Upgrade Necessary" by erikms - Thu @ 01:48am

Smoketest For nightly_2008-08-28 by Visitor - Thu @ 01:45am

Re: Can a WebGUI navigation generate li's of different sizes? by knowmad - Wed @ 10:11pm

Re: WRE upgrade 0.8.3 to 0.8.4 issue by pvanthony - Wed @ 09:07pm

Re: New default WebGUI templates by rogier - Wed @ 09:18am

YAHOO.util.Easing by lrobinson - Wed @ 05:07am