Click here to register.
      
PBWG Banner


     WebGUI Dev > navigation validating unordered list

navigation validating unordered list

User rogier
Date 5/9/2008 2:13 pm
Views 1227
Rating 0    Rate [
|
]
Previous · Next
User Message
rogier

There have been a couple of discussions about making a validating (xhtml 1.0 strict) nested unordered list with the navigation template (here, here and here). Allthough there were some useful suggestions, the problem was not solved. Because what we really want is a template that generates a validating nested unordered list regardless of what the navigation settings are.

I want to see this solved, so I have attempted to pin point the problem and thus take a first step towards finding a solution. Now I'm not a programmer, so I can only do so much, but I hope somebody with the right skills will take a look if what I'm saying is correct and if it is possible to solve this once and for all.

So here it is...

When I make a navigation I can get it to validate, but have to "tailor" it depending on the navigation settings (start point type, start point, relatives to include etc.). The reason why it is not possible to make a template for every possible setting is as follows:

  • the loop that is used for closing the ul (after the last page) is the <tmpl_loop page.indent_loop>.
  • this runs x times, where x is the relDepth of the last page.
  • it stops when page.relDepth = 0, because then it has -supposedly- arrived at the same level as the first page
  • problem: the page.relDepth of the first page is not always 0! Depending on the settings of the navigation it can be 1, -1, -2 (and maybe even more different values, though I have only come across these). The template will then close the list with either too few or too many ul and li tags.

There are two possible solutions I can think of:

  1. Add a loop just like the page.indent_loop, which does not stop at page.relDepth = 0, but also goes into the negative numbers.
  2. Change the way that the page.relDepth variable is assigned, so that it is always 0 at the first level.

If one of these solution is implemented, making a template is quite easy. I have attached an example, that is hardly any different from the default bulleted list template (only the last part is different).

Please do ask me if something of the above is not clear. Thanks in advance.

 

Rogier | United Knowledge
www.unitedknowledge.nl · www.webgui-help.nl



Attached Files
Back to Top
Rate [
|
]
 
 
JT
Not that I have the time to volunteer to create this, but I think the  
easy solution here is to simply have a switch in the navigation  
properties that generates the nav tree has hierarchical rather than  
flat. So it would create a loop within a loop within a loop within a  
loop. It shouldn't take too many hours to make it happen, but right  
now I only have time for WebGUI Shop.


Back to Top
Rate [
|
]
 
 
martink
rogier@unitedknowledge.nl wrote:
> rogier wrote:
>
>    1. Add a loop just like the page.indent_loop, which does not stop
>       at page.relDepth = 0, but also goes into the negative numbers.
>

If your problem only concerns the first page in the loop why not use a
?


You might also want to check out the page.depthDiff variable, which has
been added specificlally for producing closing tags.
What this does is substracting the depth of the current page from the
depth of the page before it in the loop. That way you'll get the number
of generations in the tree that are in between two pages.

If the number is positive (that means: the tree hierarchy goes towards
the root again) you'll also have the tmpl_loop page.depthDiff_loop,
which iterates depthDiff times.


Martin



Back to Top
Rate [
|
]
 
 
rogier

First of all: thank you both for your sugestions.

Not that I have the time to volunteer to create this, but I think the  
easy solution here is to simply have a switch in the navigation  
properties that generates the nav tree has hierarchical rather than  
flat. So it would create a loop within a loop within a loop within a  
loop. It shouldn't take too many hours to make it happen, but right  
now I only have time for WebGUI Shop.

I agree with you that a hierarchical way of making an unordered list would be a great solution. But adding a switch means that we would be making an already complex asset even more complicated. The user would have to select a template depending on the setting of this flat/hierarch. switch. While what we really want is to have one bulleted list template that works with any settings.

 

If your problem only concerns the first page in the loop why not use a
?

Something missing here.

 

You might also want to check out the page.depthDiff variable, which has
been added specificlally for producing closing tags.
What this does is substracting the depth of the current page from the
depth of the page before it in the loop. That way you'll get the number
of generations in the tree that are in between two pages.

If the number is positive (that means: the tree hierarchy goes towards
the root again) you'll also have the tmpl_loop page.depthDiff_loop,
which iterates depthDiff times.

If only...

I tried many different ways of closing the loop. I know what the depthDiff stuff does and sadly it doesn't work. There is no page after the last page, so there is no way to calculate the depthDiff.

 

Rogier | United Knowledge
www.unitedknowledge.nl · www.webgui-help.nl



Back to Top
Rate [
|
]
 
 
martink
rogier@unitedknowledge.nl wrote:
> rogier wrote:
>
>
>     /If your problem only concerns the first page in the loop why not
>     use a
>     ?
>     /
>
> Something missing here.
>

That would be the 'tmpl_unless __FIRST__'. It put that in >< brackets in
the original post but thos were probably filtered out as invalid html.

> If only...
>
> I tried many different ways of closing the loop. I know what the
> depthDiff stuff does and sadly it doesn't work. There is no page after
> the last page, so there is no way to calculate the depthDiff.
>

It is true that you cannot use depthDiff to generate the last batch of
closing tags, but for the last page in the loop relDepth has the correct
number of closing tags. relDepth has an associated loop called
page.indent_loop that you'd probably want to use for that.


Martin



Back to Top
Rate [
|
]
 
 
colink

If only...

I tried many different ways of closing the loop. I know what the depthDiff stuff does and sadly it doesn't work. There is no page after the last page, so there is no way to calculate the depthDiff.

Why not create a WebGUI package containing several navigations (and asset structures) that show the problems with the current navigation in making a validating list based nav?  Then, people can either tinker with template ideas, or with code ideas until they work correctly.

Until then, people are likely to miss all the fine details that you have learned about and offer well-meant proposals that you have already assessed and determined to be lacking.



Back to Top
Rate [
|
]
 
 
rogier

Why not create a WebGUI package containing several navigations (and asset structures) that show the problems with the current navigation in making a validating list based nav?

Then, people can either tinker with template ideas, or with code ideas until they work correctly.

Until then, people are likely to miss all the fine details that you have learned about and offer well-meant proposals that you have already assessed and determined to be lacking.

OK, point taken. I will make a package that people can use to try code ideas.

 

Rogier | United Knowledge
www.unitedknowledge.nl · www.webgui-help.nl



Back to Top
Rate [
|
]
 
 
rogier

And here it is. I hope you find it useful. There is a description of the problem as I see it on the first page. If there is anything that needs to be added or if something is not not clear, let me know.

Rogier | United Knowledge
www.unitedknowledge.nl · www.webgui-help.nl



Attached Files
Back to Top
Rate [
|
]
 
 
dionak

While looking at this package, I expected to see templates for review. It looks like just a detailed explaination of the issues you're seeing.

Topsub (Josh) and I had a similar issue on a project in recent memory. We wanted an actual unordered list that validated and worked for any level of navigation. While we're not fans of drop navigations or fly-outs, this was the type of application that required the ul list. Check out the template in this package[1] and see if it fits what you're looking for...

I believe the Template included is the same for both veritical and horizonal. The CSS is the difference between the two.

Diona

----
Knowmad Technologies
http://www.knowmad.com

[1] http://www.webgui.org/user_contributions/user_contributions/packages/drop-and-flyout-navigation

 



Back to Top
Rate [
|
]
 
 
rogier

While looking at this package, I expected to see templates for review. It looks like just a detailed explaination of the issues you're seeing.

Topsub (Josh) and I had a similar issue on a project in recent memory. We wanted an actual unordered list that validated and worked for any level of navigation. While we're not fans of drop navigations or fly-outs, this was the type of application that required the ul list. Check out the template in this package[1] and see if it fits what you're looking for...

I believe the Template included is the same for both veritical and horizonal. The CSS is the difference between the two.

Diona

----
Knowmad Technologies
http://www.knowmad.com

[1] http://www.webgui.org/user_contributions/user_contributions/packages/drop-and-flyout-navigation

 

Let me make one thing clear: it is not possible to make a template that generates a validating nested ul, regardless of what the nav setting are. Even your template (which I did check out before posting this thread, btw) does not generate a validating nested ul regardless of the nav settings.

So this is not a "I have made a nav template but it doesn't validate"-question. I am actually trying to make clear what needs to be changed in the code of the nav asset, so it will be possible to make validating navs. Which is: the way a value is assigned to the page.relDepth variable.

I do appreciate all comments on how to change this or that in the template, but I and many others have tried many things and failed. It is not what this thread is about.

 

Rogier | United Knowledge
www.unitedknowledge.nl · www.webgui-help.nl



Back to Top
Rate [
|
]
 
 

Re: How to connect a Profile Field to a User Group? by LoopSetShop - Sun @ 11:13am

Re: How to connect a Profile Field to a User Group? by LoopSetShop - Sun @ 10:45am

Re: How to connect a Profile Field to a User Group? by perlDreamer - Sun @ 10:32am

How to connect a Profile Field to a User Group? by LoopSetShop - Sun @ 09:45am

Re: WebGUI Drinks by bernd - Sun @ 07:58am

Re: RSVP function in WebGUI? by pvanthony - Sun @ 03:26am

Smoketest For nightly_2008-09-07 by Visitor - Sun @ 01:47am

Re: OReilly by koen - Sat @ 06:44pm

Re: OReilly by JT - Sat @ 12:46pm

Re: Glad to be here by Mike_S - Sat @ 09:11am