Quick Nav:  Online Store   |   Login | Register

nested or multiple conditions

Rate this topic:

Please Register to post a reply. Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.
AuthorMessages
llong
<100 Posts
Posts:96


03/27/2008 10:27 AM  

John,

Any chance of seeing more complex conditional statements in templates?

EG...

    IIF({Tab.IsActive AND Page.HasChildren}='True',class=" HasChildren SelectedItem")

Or perhaps...

    CASE(

        {Tab.IsActive}='True',class=" SelectedItem",

        {Page.HasChildren}='True',class=" HasChildren",

        default, class="Baren"

    )

Or the ability to append to a data type...

    IIF({Tab.IsActive}='True',tag.class="SelectedItem")

    IIF({Page.HasChildren}='True',tag.class+=" HasChildren")

 

...Any of these would preload logic in the CSS and reduce the need for JS or unnecessary nested items.

 

John Mitchell
Posts:3471


03/27/2008 1:50 PM  

Ok, I can look into doing some more complex logic for the next release.

I like the Case idea, and I have implemented a Switch statement like that before. The nested conditions is much harder to implement and even harder for most people to understand, but the compound logic or a switch case should cover most anything you would want to do.

That last example you can do now by doing the IIF inside of the class attribute:

< LI class="Item IIF({Page.HasChildren}='True',HasChildren)" >

llong
<100 Posts
Posts:96


03/27/2008 3:05 PM  
This was related to my other posting on the new tokens. That said, I think OR and AND would be great in handling all the states a menu could have.

For my solution, I added a conditional SPAN tag around the child menu and gave it a SelectedGroup class name. This enabled CSS to target objects in and outside the group while keeping the UL class specific to the level. The goal would be a simple UL with class="Level2 Active".
llong
<100 Posts
Posts:96


03/27/2008 3:21 PM  

About your example, problem is the IIF is limit to the node's scope downward. What I need to know is if the UL is a child of a selected/active parent. If yes, show yourself.

Something like:

  <  UL   class="Level2 IIF({Page.HasSelectedDescendant}='True',Show)" >   (as you mention)

The example I provided, the SPAN  is added at the parent level but targets the CSS at the lower levels.  This or a way for the child to look at the state of the parent like Parent.Page.IsActive but that could be confusing.

Please Register to post a reply. Another benefit of registration is the ability to subscribe to and recieve notifications of new posts.
Forums >Snapsis Product Support >CSS NavMenu > nested or multiple conditions



ActiveForums 3.7
Powered by: Snapsis Software