GetimageList need to find a parent pagetitle for sub pages at 2 different levels


It’s time to solve this issue I never really looked at.
I need to display some page dependent logos.
Because I do not wanna re-enter many images in Migx TV for various pages, I choose to enter every images into an Migx TV of a parent pages. So we need to pickup in there what is relevant.

I’m calling the GetimageList snippet with a where condition on each child pages, so they should get the logos I need.

I’m stuck with what to put into the where condition, because that works only when we are on pages 'Brand1" or 2, etc.
This is normal because the where condition uses the current *pagetitle.

I need to make this ok for every childs too. (each child of a Brand-x must uses Brand-x *pagetitle as where condition, but itself Brand-x also)
So I need to change [[*pagetitle]] in this, into something that fits my need… but … no success until now. (UltimateParent??)

the tree looks like (and there are 2 context, ine for Fr = web, another for Eng=eng, but it should not be a question):

 **Home (1)**


here’s the chunk at this time.


Thanks for any help.

I think, you could use pdoField to fetch, what you need

Thank you…but…
PdoField: [[pdoField?
won’t be enought
what I need into the where condition is this:
(don’t work in place) (the +thisParent comes from a custom snippet)

Because it all gets so convoluted and you already have a custom snippet, you could probably put all the code in your custom snippet and call GetimageList with $modx->runSnippet('getImageList',array(...)); from there.

The code would look something like this (untested and probably contains typos):

$thisParent = $modx->resource->get('parent');

//read the pagetitle
if ($thisParent == 133){
    //pagetitle from current resource
    $pagetitle = $modx->resource->get('pagetitle');
} else {
    //pagetitle from parent resource
    $parent = $modx->getObject('modResource', $thisParent);
    if ($parent) {
        $pagetitle = $parent->get('pagetitle');

//Call to getImageList
if (isset($pagetitle)){
    $where_clause = '{"title_logo:contains":"'.$pagetitle.'"}';
    return $modx->runSnippet('getImageList',array('tvname'=>'BrandsLogos','tpl'=>'PanelLogosTpl2','docid'=>'133','randomize'=>'0','where'=>$where_clause));
} else {
    return '';

Thank you

I’ve made something in this idea. (partially like you did).