-
- 2 Posts
Hi,
I have a snippet that’s getting the name of the parent document (if there is a child). It worked like a charm till I tried to make it multilingual. Since this Parent snippet itself uses [*ID*] to get title, It seems I can’t use YAMS data call..
Original "ParentName" snippet code:
<?php
$parent = $modx->getParent($pageId,1,’pagetitle’);
$parentName = $parent[’pagetitle’];
$currentTitle = $modx->documentObject[’pagetitle’];
if ($parentName != ""){
return $parent[’pagetitle’];
}else{
return $currentTitle;
}
?>
and a snippet call:
[!ParentName? &pageId=`[*id*]`!]
I know I could use just [[YAMS? &get=`data` &from=`pagetitle` &docid=`[*id*]`]] to get multilingual title, but I really need to get this parent thing to work.
It would be so nice if someone could help me with this one..
Thanks in advance,
Roman
-
- 697 Posts
Whats happening with that call? it looks ok.