We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30564
    • 60 Posts
    Hi all, sure this is blindingly obvious. Have 2 seperate wayfinder calls, one for a horizontal menu [in template] and a second for categories held in pages [e.g. in Content, or more precisely in a TV ’left’. The second is a vertical fly-out which uses the ’I’m here’ class of current to style both the active page & the trail, and Ultimate Parent to provide the startId [which works fine, one WF call from page to page].

    However, when I move to the page and activate the page menu, I lose the ’current’ status on the horizontal menu.

    Is there an approved method to keep ’current’ appropriately highlighted in the horizontal menu whilst rummaging in the second vertical one?

    Regards
      • 30564
      • 60 Posts
      Possible solution?

      I keep thinking there has to be an easier way, however, here’s how I got this working.

      1. Add &rowIdPrefix with content `hnav`to WayFinder horizontal menu call.
      2. Add to Row template [+wf.id+]
      This combination creates <li id=’hnavnumber where number is the links doc ID, e.g. Products = 3. When the menu is focused, of course, the ’current’ class runs the highlighting so it is irrelevant.

      Now create a Snippet. I called mine Parent.

       <?php
      $output='';
      $parentId=$modx->runSnippet('UltimateParent');
      $cssref='#hnav'.$parentId;
      $output.='<style>'.cssref.' a{background:url("images/menu_2ag.gif") no-repeat !important;}'.cssref.' a b{background:url("images/menu_2g.gif") right top !important;}</style>';
      return $output;
      ?>


      Go to the template for the pages, and add [[Parent]] directly above the horizontal menu Wayfinder call.

      Now when a page is called these 2 css rules are created. They are, of course only applied when relevant, that is from a child page setting the horizontal manu item to a visibly selected status. By the by there are two entries because I’m using a sliding doors technique if I wasn’t then it would be one call per menu item.

      Originally I posted an if.. endif construct but then sorted out the direct variable call and concatenation, so I’ve amended the post to reflect this, though it definitely included righteous swearing, ha.. Christian Bale’s got nothing on me.

      Regards
      /edit amended php code from if.. endif construct to single variable driven selector//
        • 16183
        • 1,390 Posts
        traveller_ted,

        Reading our first post there are some things that were not clear.

        1) You say that the main horizontal menu is in the website template, right?
        2)What about the second Wayfinder call, where is that placed?
        3) Could you post your chunks and the Wayfinder call
        4) Could you post some screenshots if site not live or provide a link if site is live?
        5) What do you mean by ’I’m here’ class of current ? Are you talking about the &hereClass?

        It is sometimes easier when one can visualise the problem in order to provide a better answer. Thanks.

        cheers/k

          • 30564
          • 60 Posts
          Hi K,

          1. Horizontal menu call in template.
          2. Vertical menu in individual page, uses Ultimate Parent for start id so one call used site wide.
          3. See below
          4. www.fieldandtrackinternational.com in a state of flux:)
          5. See below for clarification.

          Horizontal call [held in template]
          [!Wayfinder? &startId=`0` &config=`slidingdoors2`!]


          Config
          <?php
          	$level = 1;
          	$hereClass = ''; 
          	$selfClass = 'current'; 
          	$lastClass = '';
          	
          	$outerTpl = '@CODE:<div id="menu">
          		<ul>
          			[+wf.wrapper+]
          		</ul>
          	</div>';
          	
          	$innerTpl = '@CODE:<ul>
          		[+wf.wrapper+]
          	</ul>';
          	
          	$rowTpl = '@CODE:<li [+wf.id+] [+wf.classes+]><a href="[+wf.link+]" title="[+wf.title+]"><b> [+wf.linktext+] </b></a>[+wf.wrapper+]</li>';
          	
          	$cssTpl = '@CODE:<link rel="stylesheet" media="all" type="text/css" href="./assets/site/menu/css/slidingdoors2.css" />';
          ?>


          Horizontal Menu call in page is {{flyOutDefault}} held in TV pane1 [which is the left hand panel].

          Contents of flyOutDefault
          <div class=clear"></div>
          [!Wayfinder? &startId=`[[UltimateParent]]` &level=`0` &config=`cssplay-flyoutrevV`!]


          Config
          <?php
          	$level = 0;
          	$outerClass = 'vertical';
                  $hereClass ='current';
          
          	$outerTpl = '@CODE:<div[+wf.classes+]>
          	    <ul>
          	        [+wf.wrapper+]
          	    </ul>
          	</div>';
          	$parentRowTpl = '@CODE:<li><a [+wf.classes+] href="[+wf.link+]" title="[+wf.title+]">[+wf.linktext+]<!--[if IE 7]><!--></a><!--<![endif]-->
          		<table><tr><td>
          		[+wf.wrapper+]
          		</td></tr></table>
          		<!--[if lte IE 6]></a><![endif]-->
          	</li>';
          
          	$cssTpl = '@CODE:<link rel="stylesheet" media="all" type="text/css" href="./assets/site/menu/css/flyout_revisitedV.css" />';
          ?>