I vote for yes too....
So will this be implemented in the next release or it will wait until the major release of TP 4?
I can imagine implementing a breadcrumb, menu, subdomain implementation, language internaionalization, and a lot more, just by having this implementation by default. Is it do able during OnInit event? Fetching the data from database, and store it as an array, make it global/visible, to be accessed externally by snippets/plugins?
I’m looking forward to it guys. Keep up the good work, and thanks to OpenGeek for taking it as the next project. All the best...
Sincerely,
Wendy Novianto
Is there a way of including the parent folder itself as the first list item when using ultimate parent snippet. Ideally I need to have the parent folder for each sub-section listed
Many thanks
-
☆ A M B ☆
- 24,524 Posts
Quote from: edge at Mar 13, 2006, 07:09 AM
Is there a way of including the parent folder itself as the first list item when using ultimate parent snippet. Ideally I need to have the parent folder for each sub-section listed
You could use this snippet’s return value in another snippet to get the parent of the document whose id is returned by this one (use $modx->runSnippet in your second snippet).
$grandparent = $modx->getParent($modx->runSnippet('GetUltimateParent'));
I’m not sure what you want to do, though. If you want a list of submenu folders, with only the current document’s submenus showing, you can use a regular DropMenu and use the here class and css to show/hide the submenus.
Hi Susan
The only problem with dropmenu is that it will not show the folder (the actual start id page) which in this case I need as its represents the home page for that section. I could have made the first page within that folder the sections home page, but I have another top level menu and that lists each sections folder so that would not have worked
Many thanks for your help
-
☆ A M B ☆
- 24,524 Posts
Added an option to stop the search at a certain level.
// arguments:
// &id - the id of the document whose parent you want to find
// &top - the top of the search
// examples:
// [[GetUltimateParent?id=`45`&top=`6`]]
// will find the first parent of document #45 under document #6
// if id == 0 or top == id, will return id.
// you can use this as the startDoc for DropMenu to create specific submenus.
$top = isset($top)?$top:0;
$id = isset($id)?$id:$modx->documentIdentifier;
if($id==$top || $id==0) { return $id; }
$pid = $modx->getParent($id,1,'id');
if($pid == $top) { /* echo $id */ return $id; }
while ($pid != $top) {
$id = $pid;
$pid = $modx->getParent($id,1,'id');
if($pid == $top) { /* echo $id */ return $id; }
}
return 0; // if all else fails
Hi Susan,
Maybe I am being dense today..
I am using ultimateParent so that I can use a single template in my site. The site has six sections (Folders) and a number of section pages in each folder. I have a sub-menu which lists only the pages for the section I am in (using ultimateparent snippet as my start ID in drop menu) which all works fine.
I then need to display the folder for each section I am in as this is that sections home page. I cannot hard code any start ID information. Modx needs to display 1. the folder menutitle based on the page I am viewing . 2. Separately Dropmenu will display a list of all pages in that section using UltimateParent (Works great)
Does that make sense ?
-
☆ A M B ☆
- 24,524 Posts
Ah, I get it! You need to display the folder’s page content as the subsection’s homepage! I was totally focused on the menu itself! If a weblink won’t work because you need the id to be a variable, make a document that uses a snippet or a TV to redirect to the proper folder/document (such as the parent of the ultimate parent as I suggested below).
Waow that’s a pretty nifty trick, thanks for sharing !
.: COO - Commerce Guys - Community Driven Innovation :.
MODx est l'outil id