Size: a a a

2021 July 03

С

Сергей in Evolution CMS
Почему srav ?
источник

AG

Alexander Grishin in Evolution CMS
Да пофик)
источник

С

Сергей in Evolution CMS
match
compare
источник

AA

Am Ambrion in Evolution CMS
Может потому что diff, compare, match уже заняты? ((%
источник

AG

Alexander Grishin in Evolution CMS
😄
источник

EM

Eric Montgomery in Evolution CMS
Greetings. I am using evoSearch. In the search results, I would like to display next to each title, the parent of each result. How can I add this?
источник

EM

Eric Montgomery in Evolution CMS
I tried creating a snippet with:
$parent = $modx->getParent($modx->documentIdentifier,'','longtitle');
   return $parent['longtitle'];

but, I think it is trying to call the parent of the results page, and not for each document
источник

SV

Serguei VeseloV in Evolution CMS
Add to prepare-snippet:

$parent = ....;//code to get parent name of resource
$data['parent_name'] = $parent;
return $data;

And after this use chunk [+parent_name+] in result template.
источник

SV

Serguei VeseloV in Evolution CMS
источник

EM

Eric Montgomery in Evolution CMS
@Dreamer_0x01 Thanks for the reply.
I now have my snippet as:
$parent = $modx->getParent($modx->documentIdentifier,'','longtitle');
   return $parent['longtitle'];
 $data['parent_name'] = $parent;
 return $data;


and my chunk as:
<div class="post-block mt-4 pt-2 pb-4 post-author">
 <div class="img-thumbnail img-thumbnail-no-borders d-block pb-3">
   <a href="[+url+]"><img class="lazyload" src="assets/templates/retro-ebikes/img/lazy.png" data-src="[[phpthumb? &input=`[+Main-Image+]` &options=`w=420,h=420,zc=C`]]" alt="[+longtitle+]"></a>
 </div>
 <p><strong class="name"><a href="[+url+]" class="text-4 pb-2 pt-2 d-blockx">[+longtitle+]</a> <small class="text-muted" style="font-weight: normal;">(Found in: [+parent_name+])</small></strong></p>
 [+summary+]
 <span class="d-block d-sm-inline-block float-sm-right mt-3 mt-sm-0"><a href="[+url+]" class="btn btn-xs btn-secondary text-1 text-uppercase">Read More</a></span>
</div>


But is still does not display after "Found in:"

Do I need to add anything to the evoSearch call?
источник

E

EVO bot Лёшка in Evolution CMS
источник

SV

Serguei VeseloV in Evolution CMS
"return $parent['longtitle'];" - remove this string...
источник

SV

Serguei VeseloV in Evolution CMS
"Do I need to add anything to the evoSearch call?"  - please show what parameters you are calling it with
источник

SV

Serguei VeseloV in Evolution CMS
"$data['parent_name'] = $parent;" - During testing, simplify this place to some kind of constant to see that your code is called, for example, like this:
$data['parent_name'] = "test_string";
источник

EM

Eric Montgomery in Evolution CMS
I tried $data['parent_name'] = "test_string";
But still nothing displays.
источник

EM

Eric Montgomery in Evolution CMS
My call is:
[!evoSearch?
 &display=`2`
             
 &summary=`notags,len:250`
 &contentField=`content`
 &introField=``
             
 &filters=`AND(
   content:c.template:notin:5;
   content:c.id:notin:33,49;
   )`
               
 &tvPrefix=``
 &tvList=`Main-Image`
 &renderTV=`Main-Image`
               
 &ownerTPL=`@CODE:[+dl.wrap+]`
 &tpl=`RE-Search-Results`


Where "RE-Search-Results" is the chunk from above.
Still no luck though.
источник

SV

Serguei VeseloV in Evolution CMS
Try this minimal code...:

in template of search result page:
———
[!evoSearch?
 &tpl=`chuk_name`
 &prepare=`prepare_search_item`
!]
—————

code of chunk 'chunk_name':

<p><a href="[+url+]">[+pagetitle+]</a>([+parent_name+])</p>

——————-
code of snippet 'prepare_search_item':

$data['parent_name'] = 'my_test_string';
return $data;
источник

EM

Eric Montgomery in Evolution CMS
OK, this did work. Getting closer.
источник

SV

Serguei VeseloV in Evolution CMS
OK. Now in the snippet, pass the real name of the parent to $data['parent_name'] instead of the "my_test_string". And there will be happiness.
источник

EM

Eric Montgomery in Evolution CMS
Snippet:
$parent = $modx->getParent($modx->documentIdentifier,'','longtitle');
$data['parent_name'] = 'my_test_string';
return $data;

Displays "my_test_string" correctly.

But,
$parent = $modx->getParent($modx->documentIdentifier,'','longtitle');
$data['parent_name'] = $parent;
return $data;

Displays nothing still. 🤨
источник