Bilbo Baggins
не-не. Всё норм вроде. Error : Allowed memory size был.
Anonymous
Alexey
Alexey
человек написал про реализацию "своей админки", я привел примеры решений где это реализовано
Anonymous
ну и я привел пример, как еще проще, может кто не знает или не сталкивался, т.е. это не для вас лично, а больше для чата вообще
Alexey
так помимо dbtable есть еще различные DataGrid'ы под эво. Тут вопрос не в том, как вывести данные из ТАБЛИЦЫ, тут я показал пример перехвата стандартного вывода в админке.
Bilbo Baggins
не пустой
блин, всё равно не понимаю что я могу сделать с объектом в твиге
как получить параметр вызова DL ?
какой синтаксис использовать?
Anonymous
ну, извините, наверное я не вник
Anonymous
Pathologic
Pathologic
DocLister.getCFGDef()
Bilbo Baggins
Bilbo Baggins
))
Bilbo Baggins
начинаю вкуривать.
Я -> писал
Bilbo Baggins
гран мерси
Alexander
Сеньоры и сениориты, добавил немножко полезного в editDocs, пару плюшек для prepare. Кто то из чата вроде как раз такое хотел, не помню кто. Может Бип.
Сергей
Alexander
Да пофик)
Сергей
Am
Почему srav ?
Может потому что diff, compare, match уже заняты? ((%
Alexander
😄
RisingIsland
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?
RisingIsland
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
Serguei
Serguei
About prepare-snippets: https://github.com/evolution-cms/docs/blob/master/en/04_Extras/DocLister/02_Data%20processing%20before%20output.md
EVO bot Лёшка
Serguei
"return $parent['longtitle'];" - remove this string...
Serguei
"Do I need to add anything to the evoSearch call?" - please show what parameters you are calling it with
Serguei
"$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";
RisingIsland
I tried $data['parent_name'] = "test_string";
But still nothing displays.
RisingIsland
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.
Serguei
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;
RisingIsland
OK, this did work. Getting closer.
Serguei
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.
RisingIsland
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. 🤨
Serguei
$modx->getParent($modx->documentIdentifier,'','longtitle'); // This is wrong.
Alexey
Alexey
$parent = $modx->getParent($modx->documentIdentifier,'','longtitle'); - this is get longtitle document where call snippet
Serguei
try $modx-> getParent ($data['id']);
RisingIsland
Neither work.
Alexey
stop! $modx->getParent - return array!
You need:
$parent = $modx->getParent($data['id']);
$data['parent_name'] = $parent['longtitle'];
RisingIsland
Tried both
$modx-> getParent ($data['id']);
and
$parent = $modx->getParent($data['id'],'','longtitle');
Not working.
Alexey
or
$data['parent_name'] = $modx->db->getValue('Select longtitle from '.$modx->getFullTableName('site_content').' where id='.$data['parent']);
Serguei
try this: $data['parent_name'] = print_r($modx->getParent ($data['id']), true);
Serguei
Блин... Как по английски-то это сказать, что он массив в чанк пихает вместо строки :)
RisingIsland
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 )"
Alexey
try^ $data['parent_name'] = $modx->db->getValue('Select longtitle from '.$modx->getFullTableName('site_content').' where id='.$data['parent']);
Serguei
А лонгтитл может быть не заполнен у ресурса, тогда он не увидит ничего. Пусть pagetitle попробует сначала вывести.
RisingIsland
@dvakotaby I think this may have worked. One moment to double check... 🙏
Serguei
"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.
RisingIsland
👍 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;
Alexey
first string remove, they dont need
Serguei
"$parent = $modx->getParent($modx->documentIdentifier,'','longtitle');" - this is no need....
Serguei
:) Синхронное мышление, блин.
RisingIsland
OK. Thanks.
Now, last thing. In the chunk, How do I link that page?
Serguei
What page?
Alexey
$data['parent_link'] = $modx->makeUrl($data['parent']);
on tpl use: [+parent_link+]
Serguei
[~[+parent+]~] ?
Alexey
if im right understand
RisingIsland
@Dreamer_0x01 @dvakotaby Thank you both! I would have never been able to figure this out. Your time is greatly appreciated!!
Serguei
Да пожалуйста. :)
Axenia
Dreamer_0x01 (243.48) увеличил карму dvakotaby (692.61)
Alexey
Axenia
dvakotaby (692.61) увеличил карму Dreamer_0x01 (269.8)
Serguei
:)
Pathologic
А что случилось с Сериусом? Deleted account он теперь
Volodymyr
Am
Начал с чистого листа, видимо.
Камиль
Am
Вот это был бы поворот. ((%
Anonymous
Народ скучает, тему ищет.
Alexey
Люди, слушайте, а в Реве есть что-то типа нашего редактирования порядка вызова плагинов? Чот в упор не вижу...
P.S. через таблицу я могу посмотреть, я про админку спрашиваю
Alexey
хотя не, через таблицы тоже не вижу... Как у них порядок вызова идет, никто не в курсе?
Alexey
а, могу) Рево - зло
Камиль