Size: a a a

2021 July 03

SV

Serguei VeseloV in Evolution CMS
$modx->getParent($modx->documentIdentifier,'','longtitle'); // This is wrong.
источник

AL

Alexey Liber in Evolution CMS
may be you need: $parent = $modx->getParent($data['id'],'','longtitle'); ?
источник

AL

Alexey Liber in Evolution CMS
$parent = $modx->getParent($modx->documentIdentifier,'','longtitle'); - this is get longtitle document where call snippet
источник

SV

Serguei VeseloV in Evolution CMS
try $modx-> getParent ($data['id']);
источник

EM

Eric Montgomery in Evolution CMS
Neither work.
источник

AL

Alexey Liber in Evolution CMS
stop!  $modx->getParent - return array!
You need:
$parent = $modx->getParent($data['id']);
$data['parent_name'] = $parent['longtitle'];
источник

EM

Eric Montgomery in Evolution CMS
Tried both
$modx-> getParent ($data['id']);
and
$parent = $modx->getParent($data['id'],'','longtitle');
Not working.
источник

AL

Alexey Liber in Evolution CMS
or
$data['parent_name'] = $modx->db->getValue('Select longtitle from '.$modx->getFullTableName('site_content').' where id='.$data['parent']);
источник

SV

Serguei VeseloV in Evolution CMS
try this: $data['parent_name'] = print_r($modx->getParent ($data['id']), true);
источник

SV

Serguei VeseloV in Evolution CMS
Блин... Как по английски-то это сказать, что он массив в чанк пихает вместо строки :)
источник

EM

Eric Montgomery in Evolution CMS
No and no. Sorry guys.
$parent = $modx->getParent($modx->documentIdentifier,'','longtitle');
$data['parent_name'] = print_r($modx->getParent ($data['id']), true);
return $data;

Gives and output of "Array ( [id] => 33 [pagetitle] => Accessories [description] => [alias] => accessories [parent] => 0 )"
источник

AL

Alexey Liber in Evolution CMS
try^ $data['parent_name'] = $modx->db->getValue('Select longtitle from '.$modx->getFullTableName('site_content').' where id='.$data['parent']);
источник

SV

Serguei VeseloV in Evolution CMS
А лонгтитл может быть не заполнен у ресурса, тогда он не увидит ничего. Пусть pagetitle попробует сначала вывести.
источник

EM

Eric Montgomery in Evolution CMS
@dvakotaby I think this may have worked. One moment to double check... 🙏
источник

SV

Serguei VeseloV in Evolution CMS
"Array ( [id] => 33 [pagetitle] => Accessories [description] => [alias] => accessories [parent] => 0 )" this is correct result. Now you can change array output to one of their element.
источник

EM

Eric Montgomery in Evolution CMS
👍 This snippet works correctly:
$parent = $modx->getParent($modx->documentIdentifier,'','longtitle');
$data['parent_name'] = $modx->db->getValue('Select longtitle from '.$modx->getFullTableName('site_content').' where id='.$data['parent']);
return $data;
источник

AL

Alexey Liber in Evolution CMS
first string remove, they dont need
источник

SV

Serguei VeseloV in Evolution CMS
"$parent = $modx->getParent($modx->documentIdentifier,'','longtitle');" - this is no need....
источник

SV

Serguei VeseloV in Evolution CMS
:) Синхронное мышление, блин.
источник

EM

Eric Montgomery in Evolution CMS
OK. Thanks.
Now, last thing. In the chunk, How do I link that page?
источник