We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7131
    • 83 Posts
    dernier_recours Reply #1, 18 years ago
    A programmer has hacked DropMenu for a split menu on our site. It allows to get the first parent of the menu, like an automatic startDoc.

    In the dropmenu snippet, paste the followings.

    In configuration parameters:
    // $startFromParent [ true | false ]
    // If true, get the first parent of menu. Like an automatic startDoc
    // [[DropMenu?parentID]]
    $startFromParent = (!isset($startFromParent)) ? false : ($startFromParent==true);


    Below "End config, the rest takes bare of itself"
    if($startFromParent==true)
    {
    	// document id
    	$cid = $modx->documentObject['id'];
    	// document parent
    	$pid = $modx->getParent($cid,1,"id");
    
    	$ptarr=array();
    	$ptarr[]=$cid;
    	while ($parent=$modx->getPageInfo($pid['id'])) 
    	{
    		$ptarr[]=$parent['id'];
    	   $pid = $modx->getParent($parent['id'],1,"id");
    	}
    	$ptarr = array_reverse($ptarr);
    	$startDoc=$ptarr[0];
    }
      at the edge of dawn,
      you ask yourself if your shadow did follow you down
      all night long
      • 6726
      • 7,075 Posts
      I am surprised nobody picked up on that one !

      Thanks for posting the code grin
        .: COO - Commerce Guys - Community Driven Innovation :.


        MODx est l'outil id
        • 8478
        • 29 Posts
        I have been searching for this the last few hours... great work, you rock.
          -Ed
          • 34017
          • 898 Posts
          This is great.

          Thanks.

          Chuck
            Chuck the Trukk
            ProWebscape.com :: Nashville-WebDesign.com
            - - - - - - - -
            What are TV's? Here's some info below.
            http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
            http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008
            • 15682
            • 5 Posts
            Can someone help me in getting this to work... a little more of a step by step guide. I’m greeeen. I’ve added this to the Snippit but what do I use to call it...

            edmeehan, your site has just what I’m looking for. The sub-nav of your photo’s underneath your main nav. But I only need it to display the Menu title and the third sub menu when clicked on.

            I need it to add to my site so I can post the 2 and 3rd subs of my main navigation. I’m looking to add this just above the company news.

            http://spa-designer.com/

            Thanks for help on this.

            Derek
              • 8478
              • 29 Posts
              [[DropMenu? &startFromParent=`true` &topnavClass=`sub_menu`]]


              Above is what I used to display the sub menu with a class called sub_menu, but as for displaying a third level document only I would not know where to start. Might try and use your style sheet to hide a portion of the nav until your ready to display it. ScottyDelicious did a tutorial on CSS and drop menus on this forum.
                -Ed
                • 1804
                • 13 Posts
                dernier_recours’ mod should be included in the next version of Modx.
                  • 11389
                  • 4 Posts
                  Quote from: antiver at Jul 23, 2006, 08:56 PM

                  dernier_recours’ mod should be included in the next version of Modx.

                  I agree completely, this feature should be implemented immediately in Modx.
                    • 33337
                    • 3,975 Posts
                    Check Wayfinder, the successor of DropMenu. I think it has the functionality you are asking for.

                    regards.

                    zi
                      Zaigham R - MODX Professional | Skype | Email | Twitter

                      Digging the interwebs for #MODX gems and bringing it to you. modx.link