Announcement

Collapse
No announcement yet.

navigation = conditional nightmare

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    navigation = conditional nightmare

    i'm trying to get something similar to:

    http://community.actinic.com/showthread.php?t=23159

    still... after god knows how many months, i return to this, and its still uber complex.

    What i want, is this:
    HTML Code:
    <div>
    	<p>Level 1 section</p>
    		<ul>
    			<li>level 2 section</li>
    			<li>level 2 section</li>
    			<li>level 2 section</li>
    		</ul>
    	
    	<p>Level 1 section</p>
    		<ul>
    			<li>level 2 section</li>
    			<li>level 2 section</li>
    			<li>level 2 section</li>
    		</ul>
    	
    	<p>Level 1 section</p>
    		<ul>
    			<li>level 2 section</li>
    			<li>level 2 section</li>
    			<li>level 2 section</li>
    		</ul>
    </div>
    from what i'v gathered, from various experiments, creating this kind of culled sitemap esque navigation is not possible. this is becasue the <ul> tags can never be correctly positioned.

    <actinic:variable name="ListIndex" /> is useful in this sense, becasue it allows you to select the first and last items, wrapping an <ul> around them, but for items mid list, (such as the items on the second section <li>).

    i'm ultra confused by this, can anyone shed some light? perhaps i'm missing something vital.

    What i'd really like is perhaps a snippets callery, where very useful snippets for thigs like this are collected. to saze us all a lot of time when we have problems like this one. i'v been unwittingly boggling over this one for about 4 hours now.

    HTML Code:
    <actinic:block if="fun%20%3d%3d%20true">	
    time flies
    </actinic:block>

    #2
    There's another Variable - SectionLevel that is useful here. Store it in a temporary PHP variable and in your main loop compare the current value with the previous. If it's greater, you've just started a new sub-section. If it's the same, you're in another same level section. If it's smaller, you've just left a sub-section.

    I use this in my NorList menu and it works fine.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      -=#Hero#=-

      Comment


        #4
        Here's another trick. If you're generating HTML it may be useful to leave off the < and > so you can see what's happening. Create a Site level True/False variable called Testing and use code like:
        Code:
        if (<actinic:variable name="Testing" encoding="perl" selectable="false"/>)
          {
          $o = '';
          $c = '';
          }
        else
          {
          $o = '<';
          $c = '>';
          }
        .
        .
        .
        echo $o . 'ul' . $c;
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          Gabriel does this mean you have solved the hideously bad looking sitemap?

          Comment


            #6
            PHP Code:
            <actinic:block php="true" >
                    
            $lastlevel 1;
            </
            actinic:block>

            <
            actinic:block type="EntireSectionList" >  
            <
            actinic:block php="true" >
                
            $thislevel "<actinic:variable name="SectionLevel" />";
                
            $thissectionname "<actinic:variable name="SectionName" />";
                
            $thissectionpagename "<actinic:variable name="SectionPageName" />";
                
                if (
            $thislevel == $lastlevel 1)
                {
                 echo 
            "<ul>\n";
                }

                if (
            $thislevel == $lastlevel 1)
                {
                 echo 
            "</ul>\n";
                }
                
                if (
            $thislevel == 2
                {
                echo 
            "<li>".$thislevel."/".$lastlevel." - ".$thissectionname."</li>";
                }
                
                if (
            $thislevel == 1
                {
                echo 
            "<p>".$thislevel."/".$lastlevel." - ".$thissectionname."</p>\n";
                }



                
            $lastlevel "<actinic:variable name="SectionLevel" />";
                
            </
            actinic:block
            </
            actinic:block

            this, seems to work, can anyone confirm?

            i get:
            HTML Code:
            <p>1/1 - Books</p>
            <ul>
            <li>2/1 - wefawefwe</li> 
            <li>2/2 - triple test</li> 
            <li>2/2 - double test</li> 
            </ul>
            <p>1/2 - Clothing</p>
            <ul>
            <li>2/1 - test</li> 
            <li>2/2 - Shoes</li> 
            </ul>
            <p>1/2 - Homeware</p>
            <p>1/1 - Computers</p>
            <p>1/1 - Stationery</p>
            <p>1/1 - Best Sellers</p>
            <p>1/1 - New Products</p>

            Comment


              #7
              Hi guys. I want to be able to just display one section (and it's subsections) as a navigation list. Is it possible in this way?

              Comment


                #8
                I guess the threads above will be the best guide to be able to achieve what you are after.

                Kind regards,
                Bruce King
                SellerDeck

                Comment


                  #9
                  Hi,

                  I managed to do it by changing the page file extensions to .php and just using a normal php include.

                  Comment

                  Working...
                  X