Announcement

Collapse
No announcement yet.

.: Dynamic Php Sitemap Navigation :.

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

    .: Dynamic Php Sitemap Navigation :.

    Hi all,

    I am trying to develop a PHP based Site Map Section List that can automatically assign an active class to the link of the current page and an inactive class to all the other links. The idea stems from the following link: http://brainstormsandraves.com/archi...27/navigation/

    My idea was to use

    Code:
    <actinic:block php="true" >
    $thisPage='<actinic:variable name="SectionName" />';
    </actinic:block>
    to create a variable that has a value of books in the books section, computers in computers, etc. Unfortunately for some reason this isn't parsing - it does when the $thisPage value is a typed word therefore I assume it has a problem with that variable.

    The next part was to use use

    Code:
    <actinic:block php="true" >
    if ($thisPage=='<actinic:variable name="SectionName" />') 
          {echo '<actinic:variable name="SectionName" />';} 
       else 
          {echo '<a href="/"><actinic:variable name="SectionName" /></a>';}
    </actinic:block>
    unfortunately this is not working and now I am rather stuck on this! I can't help but think that the variable SectionName is being used to often. The way it is used to identify the individual section title in the INNERLAYOUT and all the sections in the SiteMap Section List seems really interesting to me however I can't find the variable in the variable tab and thus I am struggling to discover how SectionName is being used so differently in the two layouts.

    Has anyone got any thoughts on how I can go about creating this menu as it is driving me nuts

    Cheers in advance

    #2
    Code like this fails in Design view because Actinic adds extra markup.

    Change all

    '<actinic:variable name="SectionName" />'

    to

    '<actinic:variable name="SectionName" encoding="perl" selectable="false" />'

    Also see http://community.actinic.com/showthread.php?t=33498 where a similar thing is being discussed.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Best not post in more than one place. It confuses some and annoys others.
      Norman - www.drillpine.biz
      Edinburgh, U K / Bitez, Turkey

      Comment


        #4
        Hi Norman,

        Cheers for quick response. Shall give that a try - had seen the other post - found the final code was repeating sections many times

        <actinic:block if="%3cactinic%3avariable%20name%3d%22SectionNamePrev%22%20%2f%3e%20%21%3d%20%22%22" ></actinic:block>
        <actinic:block if="%3cactinic%3avariable%20name%3d%22SectionNamePrev%22%20%2f%3e%20%3d%3d%20%22%22" ><ul><li></actinic:block>
        <actinic:block if="%28%3cactinic%3avariable%20name%3d%22SectionNamePrev%22%20%2f%3e%20%21%3d%20%22%22%29"><li></actinic:block>
        <a href="<actinic:variable name="SectionPageName"/>"><actinic:variable name='SectionName'/></a>
        <actinic:block if="%3cactinic%3avariable%20name%3d%22SectionNameNext%22%20%2f%3e%20%3d%3d%20%22%22" ></li></li></ul></actinic:block>
        removing something from the code solved that however haven't tested number of section levels.

        However it didn't really seem to look into dynamically assigned classes.

        Comment


          #5
          Fair dos - Cheers for the heads up

          Comment


            #6
            i can tell you from actually completing this puzzle, that you'd best be ready for super duper slowdown.

            in soviet russia, php parses you!

            Comment


              #7
              Navigation with highlighted hover and current states

              Hi all,

              thanks for responses - specially to Mr Hackett for pointing me back to the AUG. The most recent version has a perfectly good solve for this one.

              for future reference here is the finished solution including styles

              Highlighting the 'Current' Section in the Section List

              1.Change to the 'Design' tab.

              2.Click on the section link in the sidebar that you want to be highlighted.
              You will probably now be in a layout called something like 'Section Name Only Section Link' or 'Site Map Section Link'. You can check this within the title bar of the 'Layout Code' panel at the bottom left of the 'Design' tab.

              3.Insert some code into the layout to highlight the section link.

              4.Click 'Apply'.
              Now every section link should appear highlighted.

              5.Now select the code you just inserted.

              6.Click the 'Insert Block' button:

              7.Use the following code for the condition:
              <actinic:variable name="SectionName" /> == <actinic:variable name="MainSection::SectionName" />
              8.Click 'OK'.

              to include hover states of the navigation create appropriate class and assign it to the anchor tag before the block if.

              Finished code on mine goes as follows

              Site Map Section Link

              <a class="sidenavbtn" <actinic:block if="%3cactinic%3avariable%20name%3d%22SectionName%22%20%2f%3e%20%3d%3d%20%3cactinic%3avariable%20name%3dMainSection%3a%3aSectionName%22%20%2f%3e" >
              style="background-color:#6699cc; color:#FFFFFF; display:block; padding:2px 2px 2px 2px; font-weight:bold;"
              </actinic:block> href='<actinic:block if="%3cactinic%3avariable%20name%3d%22IsLoginPageSuppressed%22%20%2f%3e%20AND%0d%3cactinic%3avariable%20name%3d%22UnregCustomersAreNotAllowed%22%20%2f%3e" ><actinic:variable name="SectionPageName" /></actinic:block><actinic:block if="%28%3cactinic%3avariable%20name%3d%22IsLoginPageSuppressed%22%20%2f%3e%20%3d%3d%20false%29%20OR%0d%28%3cactinic%3avariable%20name%3d%22UnregCustomersAreNotAllowed%22%20%2f%3e%20%3d%3d%20false%29" ><actinic:variable name="SectionURL" /></actinic:block>'>
              <actinic:block if="%3cactinic%3avariable%20name%3d%22IsSectionIncludedInSiteMap%22%20%2f%3e" >
              <actinic:block if="%3cactinic%3avariable%20name%3d%22SectionLevelIsGreaterThan1%22%20%2f%3e">&nbsp;&nbsp;</actinic:block>
              <actinic:block if="%3cactinic%3avariable%20name%3d%22SectionLevelIsGreaterThan2%22%20%2f%3e">&nbsp;&nbsp;</actinic:block>
              <actinic:block if="%3cactinic%3avariable%20name%3d%22SectionLevelIsGreaterThan3%22%20%2f%3e">&nbsp;</actinic:block>
              <actinic:block if="%3cactinic%3avariable%20name%3d%22SectionLevelIsGreaterThan4%22%20%2f%3e">&nbsp;</actinic:block>
              <actinic:block if="%3cactinic%3avariable%20name%3d%22SectionLevelIsGreaterThan5%22%20%2f%3e">&nbsp;</actinic:block>
              <actinic:block if="%3cactinic%3avariable%20name%3d%22SectionLevelIsGreaterThan6%22%20%2f%3e">&nbsp;&</actinic:block>
              <actinic:block if="%3cactinic%3avariable%20name%3d%22SectionLevelIsGreaterThan7%22%20%2f%3e">&nbsp;</actinic:block>

              &bull;&nbsp;<Actinic:Variable Name="SectionName">

              <br />
              </actinic:block>
              </a>
              Stylesheet

              a.sidenavbtn:link{background-color:#FFF; color:#000066; display:block; padding:2px 2px 2px 0px; font-weight:bold;}
              a.sidenavbtn:visited{background-color:#FFF; color:#000066; display:block; padding:2px 2px 2px 0px; font-weight:bold;}
              a.sidenavbtn:hover{background-color:#99ccff; color:#FFFFFF; display:block; padding:2px 2px 2px 2px; font-weight:bold;}

              Comment

              Working...
              X