Dec 04, 2008, 12:38 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
Search via SMF or Google: modx forums all of modxcms.com web
  MODxCMS.com   Forums   Help Login Register  
News:Read what MODx Developers say: MODx Dev. Blogs
Pages: [1]   Go Down
  Print  
Author Topic: DropMenu startFromParent  (Read 5486 times)
0 Members and 1 Guest are viewing this topic.
dernier_recours
Member
**
Posts: 83



« on: Apr 23, 2006, 11:11 AM »

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:
Code:
// $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"
Code:
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];
}
« Last Edit: Apr 23, 2006, 11:19 AM by dernier_recours » Logged

at the edge of dawn,
you ask yourself if your shadow did follow you down
all night long
davidm
Marketing & Design Team
*
Posts: 6,777


The best way to predict the future is to invent it


WWW
« Reply #1 on: May 09, 2006, 03:06 PM »

I am surprised nobody picked up on that one !

Thanks for posting the code Grin
Logged

.: nodeo.net : Pour un web libre, moderne et ouvert ! :: david-molliere.net : Suivez en "live" mes expérimentations et billets sur les CMS et autres applications web :.

*** Forums modxcms.fr Participez à l'élaboration du site MODx francophone ! ***

! Nouveau !  En live, ne manquez pas les news de modxcms.fr sur Twitter   ! Nouveau !

MODx est l'outil idéal pour les developpeurs et webdesigners qui cherchent un framework de gestion de contenu hautement flexible et performant, tout en étant simple d'accès pour les utilisateurs finaux.

Config : Apache 2.2.8 - MySQL 5.0.45 - PHP 5.2.6 | Debian 4.0 (Etch)

Réalisations sous MODx : | pargade-notaires.fr | soleil.info | gican.asso.fr | michelez-notaires.com | amadom.gerondicap.com | jocelyne-violet.net
edmeehan
Jr. Member
*
Posts: 29


It's just a deck of cards!


WWW
« Reply #2 on: Jun 27, 2006, 09:10 PM »

I have been searching for this the last few hours... great work, you rock.
Logged

-Ed
ChuckTrukk
Committed to MODx
*****
Posts: 638



WWW
« Reply #3 on: Jun 29, 2006, 02:15 AM »

This is great.

Thanks.

Chuck
Logged

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
keredb
Jr. Member
*
Posts: 5


« Reply #4 on: Jul 02, 2006, 02:58 AM »

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
« Last Edit: Jul 02, 2006, 12:53 PM by keredb » Logged
edmeehan
Jr. Member
*
Posts: 29


It's just a deck of cards!


WWW
« Reply #5 on: Jul 02, 2006, 02:29 PM »

Code:
[[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.
Logged

-Ed
antiver
Jr. Member
*
Posts: 13


« Reply #6 on: Jul 23, 2006, 03:56 PM »

dernier_recours' mod should be included in the next version of Modx.
Logged
grooo
Jr. Member
*
Posts: 4


« Reply #7 on: Oct 10, 2006, 03:27 AM »

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

I agree completely, this feature should be implemented immediately in Modx.
Logged
zi
MODx Special Forces /
Administrator
*
Posts: 3,014


May Peace Be On You


WWW
« Reply #8 on: Oct 10, 2006, 04:38 AM »

Check Wayfinder, the successor of DropMenu. I think it has the functionality you are asking for.

regards.

zi
Logged

“Internet Explorer’s CSS rendering: WYSIWTF”. — someone genius
--------------------------------------------------
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP

Copyright © 2005-2008 MODxCMS, All rights reserved. Contact Us
Styles by ziworks.com

Powered by SMF 1.1.4 | SMF © 2005, Simple Machines LLC

Valid XHTML 1.0! Valid CSS!