|
Previous
·
Next
|
wouter
|
Date: 7/18/2006 3:50 pm · Subject: Unordered List with Navigation Template? · Rating: 6
It seems impossible to me to create an XHTML compliant unordered list with Navigation templates. Did I miss something? Has anybody succeeded in creating this?
If such a template could be made, that would be very cool, because it is already useful in its own right, but together with CSS this is a very powerful combination. You could create almost any type of navigation with an unordered list and some CSS. It would also be very easy to switch to a completely different layout, by only changing the stylesheet (even on-the-fly if you want).
The nested structure of UL's can be used for other purposes as well, but I'm having troubles with the last item, that should close all the open tags. For example, if I have a structure like:
1 1.2 1.2.3
this should produce:
[ul] [li] 1 [ul] [li] 1.2 [ul] [li] 1.2.3 [/li] [/ul] [/li] [/ul] [/li] [/ul]
However, I didn't find out how to generate the last 3 [/li] tags?
So far, I only succeeded by creating this using javascript, but that's not a good solution.
Maybe a template variable should be added to make this possible. Either a property that describes if a page is the last of the navigation (not the last in the current directory), or something like a lastPageDepth_loop.
Wouter
|
| Back to Top |
Rate [ | ]
|
| |
martink
|
Date: 7/18/2006 3:55 pm · Subject: Re: Unordered List with Navigation Template? · Rating: 15
I'm pretty sure I once solved this problem in older webgui's. I'll see if I can do the same on 7.x tomorrow.
Martin
webguidev@plainblack.com wrote:
> wouter wrote: > > It seems impossible to me to create an XHTML compliant unordered list > with Navigation templates. Did I miss something? Has anybody succeeded > in creating this? > > If such a template could be made, that would be very cool, because it is > already useful in its own right, but together with CSS this is a very > powerful combination. You could create almost any type of navigation > with an unordered list and some CSS. It would also be very easy to > switch to a completely different layout, by only changing the stylesheet > (even on-the-fly if you want). > > The nested structure of UL's can be used for other purposes as well, but > I'm having troubles with the last item, that should close all the open > tags. For example, if I have a structure like: > > 1 > 1.2 > 1.2.3 > > this should produce: > > [ul] > [li] 1 > [ul] > [li] 1.2 > [ul] > [li] 1.2.3 > [/li] > [/ul] > [/li] > [/ul] > [/l i] > [/ul] > > However, I didn't find out how to generate the last 3 [/li] tags? > > So far, I only succeeded by creating this using javascript, but that's > not a good solution. > > Maybe a template variable should be added to make this possible. Either > a property that describes if a page is the last of the navigation (not > the last in the current directory), or something like a > lastPageDepth_loop. > > Wouter > > > http://www.plainblack.com/webgui/dev/discuss/unordered-list-with-navigation-template > > >------------------------------------------------------------------------ > > > > >
|
| Back to Top |
Rate [ | ]
|
| |
crythias
|
Date: 7/18/2006 3:58 pm · Subject: Re: Unordered List with Navigation Template? · Rating: 8
Why? I mean, seriously... anything you can do with LI you can do with span and class.
|
| Back to Top |
Rate [ | ]
|
| |
pwrightson
|
Date: 7/18/2006 4:30 pm · Subject: Re: Unordered List with Navigation Template? · Rating: 9
Sorry about the previous post not showing the code properly. This is working for me in 6.3 -> 6.8 <ul> <tmpl_loop page_loop> <tmpl_if page.depthDiffIs-1><ul></tmpl_if> <tmpl_loop page.depthDiff_loop></ul></tmpl_loop> <li><a <tmpl_if page.newWindow>target="_blank"</tmpl_if> href="<tmpl_var page.url>"> <tmpl_if page.isCurrent><span class="selectedMenuItem"><tmpl_var page.menuTitle></span> <tmpl_else><tmpl_var page.menuTitle></tmpl_if></a></li> <tmpl_if __LAST__><tmpl_loop page.indent_loop></ul></tmpl_loop></tmpl_if> </tmpl_loop> </ul>
webguidev@plainblack.com wrote:
> martink wrote: > > I'm pretty sure I once solved this problem in older webgui's. I'll see > if I can do the same on 7.x tomorrow. > > Martin > > webguidev@plainblack.com wrote: > > > wouter wrote: > > > > It seems impossible to me to create an XHTML compliant unordered list > > with Navigation templates. Did I miss something? Has anybody succeeded > > in creating this? > > > > If such a template could be made, that would be very cool, because it is > > already useful in its own right, but together with CSS this is a very > > powerful combination. You could create almost any type of navigation > > with an unordered list and some CSS. It would also be very easy to > > switch to a completely different layout, by only changing the stylesheet > > (even on-the-fly if you want). > > > > The nested structure of UL's can be used for other purposes as well, but > > I'm having troubles with the last item, that should close all the open > > tags. For example, if I have a structure like: > > > > 1 > > 1.2 > > 1.2.3 > > > > this should produce: > > > > [ul] > > [li] 1 > > [ul] > > [li] 1.2 > > [ul] > > [li] 1.2.3 > > [/li] > > [/ul] > > [/li] > > [/ul] > > [/l i] > > [/ul] > > > > However, I didn't find out how to generate the last 3 [/li] tags? > > > > So far, I only succeeded by creating this using javascript, but that's > > not a good solution. > > > > Maybe a template variable should be added to make this possible. Either > > a property that describes if a page is the last of the navigation (not > > the last in the current directory), or something like a > > lastPageDepth_loop. > > > > Wouter > > > > > > > http://www.plainblack.com/webgui/dev/discuss/unordered-list-with-navigation-template > > > > > > >------------------------------------------------------------------------ > > > > > > > > > > > > > > http://www.plainblack.com/webgui/dev/discuss/unordered-list-with-navigation-template/1 > > >------------------------------------------------------------------------ > > > > >
|
| Back to Top |
Rate [ | ]
|
| |
wouter
|
Date: 7/18/2006 5:04 pm · Subject: Re: Unordered List with Navigation Template? · Rating: 8
If with "working" you mean that it is rendered correctly in most browsers, than you're probably right. However, you close the li tags before going into a deeper level (next ul-tag), which is not allowed in any HTML-standard.
|
| Back to Top |
Rate [ | ]
|
| |
pwrightson
|
Date: 7/18/2006 5:25 pm · Subject: Re: Unordered List with Navigation Template? · Rating: 4
You know - when you're right, you're right. Lets see what we can do about that.
webguidev@plainblack.com wrote:
> wouter wrote: > > If with "working" you mean that it is rendered correctly in most > browsers, than you're probably right. > However, you close the li tags before going into a deeper level (next > ul-tag), which is not allowed in any HTML-standard. > > > http://www.plainblack.com/webgui/dev/discuss/unordered-list-with-navigation-template/12 > > >------------------------------------------------------------------------ > > > > >
|
| Back to Top |
Rate [ | ]
|
| |
JT
|
Date: 7/18/2006 4:25 pm · Subject: Re: Unordered List with Navigation Template? · Rating: 9
> wouter wrote: It seems impossible to me to create an XHTML compliant unordered list > with Navigation templates. Did I miss something? Has anybody succeeded > in creating this?
It's not impossible. It's just not very straight forward. Our designer actually put a template into WebGUI 7 for this, but for some reason it never got imported...so that's something I need to check on. Anyway, here's the gist of it:
page.newWindow>onclick="window.open('')" href="#" href="">
JT ~ Plain Black ph: 703-286-2525 ext. 810 fax: 312-264-5382 http://www.plainblack.com
I reject your reality, and substitute my own. ~ Adam Savage
|
| Back to Top |
Rate [ | ]
|
| |
wouter
|
Date: 7/18/2006 6:17 pm · Subject: Re: Unordered List with Navigation Template? · Rating: -1
"It seems impossible to me to create an XHTML compliant unordered list with Navigation templates. Did I miss something? Has anybody succeeded in creating this?"
Oh, I'm stupid! Yes, I missed something... The __LAST__ template variabele is needed for the proper closing. It just wasn't documented in the Navigation Template documentation, but only in the Template Language help docs, where I didn't search :)
So, a possible template which generates (at least for my test cases) valid XHTML is:
<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 page.isRankedFirst> <ul class="level<tmpl_var page.relDepth>"> </tmpl_if>
<tmpl_loop page.depthDiff_loop> </li> </ul> </tmpl_loop>
<tmpl_unless page.isRankedFirst> </li> </tmpl_unless>
<li class="level<tmpl_var page.relDepth>"><a href="<tmpl_var page.url>"><tmpl_var page.menuTitle></a>
<tmpl_if __LAST__> <tmpl_loop page.indent_loop> </li> </ul> </tmpl_loop> </tmpl_if>
</tmpl_loop>
Based on this, I revoke my suggestion that new template variables are necessary :) I'll commit a fixed version of the "Bulleted List" navigation template later.
|
| Back to Top |
Rate [ | ]
|
| |
wouter
|
Date: 7/19/2006 9:07 am · Subject: Re: Unordered List with Navigation Template? · Rating: 12
Hmm, even my last template does not always give the correct result. The problem is that the page.indent_loop is run page.relDepth times, where page.relDepth is relative to the starting point. However, the first item does not have to start at depth 0. This depends on the settings of the navigation (for example if "self" is included or not). So there is no way to find out how many closing tags are required.
A possible solutions is then to add another loop (e.g. page.close_loop), that will do the same as indent_loop, but uses the depth relative to the first item. I'm not sure if this is the best solution, though.
|
| Back to Top |
Rate [ | ]
|
| |
JT
|
Date: 7/19/2006 9:50 am · Subject: Re: Unordered List with Navigation Template? · Rating: 5
> A possible solutions is then to add another loop (e.g. page.close_loop), that will do >the same as indent_loop, but uses the depth relative to the first item. I9m not sure if >this is the best solution, though.
The real problem is that we're trying to solve a recursive problem iteratively. But I'm not sure how else to do it. Even if we turned the flat loop structure into nested loops, there'd be no way to determine how many loops deep we'd need to make the template because you can't do recursion in a template.
The problem at the end is that the outdent could go 1 level or 150 levels. You just don't know. A page.close_loop could do the job, but creating that accurately seems like a difficult task.
JT ~ Plain Black ph: 703-286-2525 ext. 810 fax: 312-264-5382 http://www.plainblack.com
I reject your reality, and substitute my own. ~ Adam Savage
|
| Back to Top |
Rate [ | ]
|
| |
|
|
Re: Duplicate web site by techwriter - Wed @ 09:07am Re: Limiting the size of avatars by bernd - Wed @ 03:45am
|