Hello,
Is there a way to get the parent ID for a document
Home(1)
Container1(2)
-Welcome(3)
-Something(4)
Container2(5)
-Welcome(6)
-Something(7)
I would like to know that when on document (3) the parent id is 1 and when on 6 the parent id is 5
I need this parent id to pass it to ditto so I get a different submenu for each page
I do not want to create different templates for each section
Thx
Hi,
[*parent*] returns the parent ID of the current document.
:-)
I had a feeling that there was a easier way to do it
I tried
<?php
$parent = $modx->getParent($this->documentIdentifier,0,’id’);
print_r($parent);
?>
Thx
-
MODX Staff
- 10,725 Posts
The current page’s properties are available through $modx->documentObject, so $modx->documentObject[’parent’] and the tag [*parent*] are equivalent representations in code vs. content.