Василий Столейков

Василий Столейков

С нами с 19 декабря 2012; Место в рейтинге пользователей: #24
30 сентября 2015, 12:57
0
Спасибо, это работает!
Только у меня сейчас не получается сделать проверку этой переменной. Мне нужен аналог:
[[+articles:notempty=`([[+articles]])`]]
[[+articles:is=`0`:then=``:else=`([[+articles]])`]]
Такой вариант не срабатывает:
{$articles == '0' ? '' : '({$articles})'}
29 сентября 2015, 21:07
0
А если определяю в переменную (1-ю строку) до вызова pdoMenu, а вторую строку указываю в &tpl, то ничего не выводит, а 1-я строка просто печатается на экран прямо в таком виде:
{var $placeholders = $_modx->getPlaceholders()}
29 сентября 2015, 21:05
0
Нет, не срабатывает…
Выбивает следующую ошибку, если вставить строки выше в @INLINE для pdoMenu:
[[+menutitle]] 
Fatal error: Call to undefined method microMODX::getPlaceholders() in /home/s****/www/core/components/pdotools/model/fenom/Fenom/Template.php(462) : eval()'d code on line 13
И вроде включил и разрешил в настройках везде и всё что касается Fenom…
29 сентября 2015, 21:01
0
Нет, обычный сниппет, типа:
[[!snippet? &par1=`par1` &par2=`par2`]] // его цель выставить плейсхолдер.
29 сентября 2015, 19:12
0
Как вывести плейсхолдер, который был установлен сниппетом в другом месте страницы?
Например: до вызова меню другой сниппет устанавливает плейсхолдер [[+my.articles]] и позволяет его вызвать в любом месте страницы.

Как вызвать его через Fenom и в INLINE-чанке pdoMenu?

У меня не работают следующие варианты:
{$_pls['my.articles']}
{$my.articles}
в то время как обычные плейсхолдеры чанка выводятся:
{$id}
{$pagetitle}

И дело совсем не в точке между my и articles (my.articles). Я пробовал разные плейсхолдеры, например: my_articles, my-articles, myarticles — всё равно не выводится.
28 сентября 2015, 10:37
+1
Спасибо что нашел решение — действительно работает! Нужно всево-то в лексиконах опросника точки служебные удалить в начале файлов…
27 сентября 2015, 14:19
+2
+ к вышеописанному подключите шаблон в &tplLast без разделителя. Не проверял лично, но &tplLast и &tplFirst из общих шаблонов должны работать.
23 сентября 2015, 15:49
0
Готов к сотрудничеству.
21 сентября 2015, 11:49
0
О! Спасибо!!!
Я с Fenom ещё на «Вы», хотя и понимаю что там всё очень просто.
Похоже пора брать себя в руки и перескочить на него… ))
21 сентября 2015, 11:34
0
Да, это бы решило проблему со стилизацией, но мне нужно только в одном пункте (Мои заявки) указать в скобках количество заявок через отдельный сниппет. А это уже пахнет отдельным шаблоном или условием, чтобы не выводилось на других пунктах.
21 сентября 2015, 09:38
0
Ок, спасибо, теперь понятно. Значит буду с помощью условий от id вычислять нужный мне пункт и модифицировать его в том же шаблоне…
21 сентября 2015, 08:05
0
Прошу прощения. Сам написал о проблеме и сам её решил… ))
Дело было в INLINE-чанке, нужно было вывести в отдельный чанк. Я же просто заменил на фигурные скобки и получилось так: {{+uri}}, {{+pagetitle}}
21 сентября 2015, 07:58
0
Да, вот и &showLog:
0.0000939: Query parameters are prepared.
0.0000210: xPDO query object created
0.0001080: leftJoined TicketsSection as Section
0.0000830: leftJoined modUser as User
0.0000799: leftJoined modUserProfile as Profile
0.0000808: leftJoined TicketVote as Vote
0.0000880: leftJoined TicketStar as Star
0.0000849: leftJoined TicketView as View
0.0000010: Grouped by Ticket.id
0.0000370: Added selection of TicketsSection: SQL_CALC_FOUND_ROWS `id` AS `section.id`, `type` AS `section.type`, `contentType` AS `section.contentType`, `pagetitle` AS `section.pagetitle`, `longtitle` AS `section.longtitle`, `description` AS `section.description`, `alias` AS `section.alias`, `link_attributes` AS `section.link_attributes`, `published` AS `section.published`, `pub_date` AS `section.pub_date`, `unpub_date` AS `section.unpub_date`, `parent` AS `section.parent`, `isfolder` AS `section.isfolder`, `introtext` AS `section.introtext`, `richtext` AS `section.richtext`, `template` AS `section.template`, `menuindex` AS `section.menuindex`, `searchable` AS `section.searchable`, `cacheable` AS `section.cacheable`, `createdby` AS `section.createdby`, `createdon` AS `section.createdon`, `editedby` AS `section.editedby`, `editedon` AS `section.editedon`, `deleted` AS `section.deleted`, `deletedon` AS `section.deletedon`, `deletedby` AS `section.deletedby`, `publishedon` AS `section.publishedon`, `publishedby` AS `section.publishedby`, `menutitle` AS `section.menutitle`, `donthit` AS `section.donthit`, `privateweb` AS `section.privateweb`, `privatemgr` AS `section.privatemgr`, `content_dispo` AS `section.content_dispo`, `hidemenu` AS `section.hidemenu`, `class_key` AS `section.class_key`, `context_key` AS `section.context_key`, `content_type` AS `section.content_type`, `uri` AS `section.uri`, `uri_override` AS `section.uri_override`, `hide_children_in_tree` AS `section.hide_children_in_tree`, `show_in_tree` AS `section.show_in_tree`, `properties` AS `section.properties`
0.0000091: Added selection of modUser: `username`
0.0000181: Added selection of modUserProfile: `internalKey`, `fullname`, `email`, `phone`, `mobilephone`, `blocked`, `blockeduntil`, `blockedafter`, `logincount`, `lastlogin`, `thislogin`, `failedlogincount`, `sessionid`, `dob`, `gender`, `address`, `country`, `city`, `state`, `zip`, `fax`, `photo`, `comment`, `website`, `extended`
0.0000911: Added selection of Ticket: `id`, `type`, `contentType`, `pagetitle`, `longtitle`, `description`, `alias`, `link_attributes`, `published`, `pub_date`, `unpub_date`, `parent`, `isfolder`, `introtext`, `content`, `richtext`, `template`, `menuindex`, `searchable`, `cacheable`, `createdby`, `createdon`, `editedby`, `editedon`, `deleted`, `deletedon`, `deletedby`, `publishedon`, `publishedby`, `menutitle`, `donthit`, `privateweb`, `privatemgr`, `content_dispo`, `hidemenu`, `class_key`, `context_key`, `content_type`, `uri`, `uri_override`, `hide_children_in_tree`, `show_in_tree`, `properties`
0.0000110: Added selection of TicketVote: `value` as `vote`
0.0000298: Added selection of TicketStar: COUNT(`id`) as `star`
0.0000229: Added selection of TicketView: COUNT(View.parent) as views
0.0005679: Processed additional conditions
0.0007329: Added where condition: class_key=Ticket, Ticket.parent:IN(34,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191), Ticket.published=1, Ticket.deleted=0
0.0000250: Sorted by views, DESC
0.0000019: Limited to 8, offset 0
0.0002480: SQL prepared "SELECT SQL_CALC_FOUND_ROWS `Section`.`id` AS `section.id`, `Section`.`type` AS `section.type`, `Section`.`contentType` AS `section.contentType`, `Section`.`pagetitle` AS `section.pagetitle`, `Section`.`longtitle` AS `section.longtitle`, `Section`.`description` AS `section.description`, `Section`.`alias` AS `section.alias`, `Section`.`link_attributes` AS `section.link_attributes`, `Section`.`published` AS `section.published`, `Section`.`pub_date` AS `section.pub_date`, `Section`.`unpub_date` AS `section.unpub_date`, `Section`.`parent` AS `section.parent`, `Section`.`isfolder` AS `section.isfolder`, `Section`.`introtext` AS `section.introtext`, `Section`.`richtext` AS `section.richtext`, `Section`.`template` AS `section.template`, `Section`.`menuindex` AS `section.menuindex`, `Section`.`searchable` AS `section.searchable`, `Section`.`cacheable` AS `section.cacheable`, `Section`.`createdby` AS `section.createdby`, `Section`.`createdon` AS `section.createdon`, `Section`.`editedby` AS `section.editedby`, `Section`.`editedon` AS `section.editedon`, `Section`.`deleted` AS `section.deleted`, `Section`.`deletedon` AS `section.deletedon`, `Section`.`deletedby` AS `section.deletedby`, `Section`.`publishedon` AS `section.publishedon`, `Section`.`publishedby` AS `section.publishedby`, `Section`.`menutitle` AS `section.menutitle`, `Section`.`donthit` AS `section.donthit`, `Section`.`privateweb` AS `section.privateweb`, `Section`.`privatemgr` AS `section.privatemgr`, `Section`.`content_dispo` AS `section.content_dispo`, `Section`.`hidemenu` AS `section.hidemenu`, `Section`.`class_key` AS `section.class_key`, `Section`.`context_key` AS `section.context_key`, `Section`.`content_type` AS `section.content_type`, `Section`.`uri` AS `section.uri`, `Section`.`uri_override` AS `section.uri_override`, `Section`.`hide_children_in_tree` AS `section.hide_children_in_tree`, `Section`.`show_in_tree` AS `section.show_in_tree`, `Section`.`properties` AS `section.properties`, `User`.`username`, `Profile`.`internalKey`, `Profile`.`fullname`, `Profile`.`email`, `Profile`.`phone`, `Profile`.`mobilephone`, `Profile`.`blocked`, `Profile`.`blockeduntil`, `Profile`.`blockedafter`, `Profile`.`logincount`, `Profile`.`lastlogin`, `Profile`.`thislogin`, `Profile`.`failedlogincount`, `Profile`.`sessionid`, `Profile`.`dob`, `Profile`.`gender`, `Profile`.`address`, `Profile`.`country`, `Profile`.`city`, `Profile`.`state`, `Profile`.`zip`, `Profile`.`fax`, `Profile`.`photo`, `Profile`.`comment`, `Profile`.`website`, `Profile`.`extended`, `Ticket`.`id`, `Ticket`.`type`, `Ticket`.`contentType`, `Ticket`.`pagetitle`, `Ticket`.`longtitle`, `Ticket`.`description`, `Ticket`.`alias`, `Ticket`.`link_attributes`, `Ticket`.`published`, `Ticket`.`pub_date`, `Ticket`.`unpub_date`, `Ticket`.`parent`, `Ticket`.`isfolder`, `Ticket`.`introtext`, `Ticket`.`content`, `Ticket`.`richtext`, `Ticket`.`template`, `Ticket`.`menuindex`, `Ticket`.`searchable`, `Ticket`.`cacheable`, `Ticket`.`createdby`, `Ticket`.`createdon`, `Ticket`.`editedby`, `Ticket`.`editedon`, `Ticket`.`deleted`, `Ticket`.`deletedon`, `Ticket`.`deletedby`, `Ticket`.`publishedon`, `Ticket`.`publishedby`, `Ticket`.`menutitle`, `Ticket`.`donthit`, `Ticket`.`privateweb`, `Ticket`.`privatemgr`, `Ticket`.`content_dispo`, `Ticket`.`hidemenu`, `Ticket`.`class_key`, `Ticket`.`context_key`, `Ticket`.`content_type`, `Ticket`.`uri`, `Ticket`.`uri_override`, `Ticket`.`hide_children_in_tree`, `Ticket`.`show_in_tree`, `Ticket`.`properties`, `Vote`.`value` as `vote`, COUNT(`Star`.`id`) as `star`, COUNT(View.parent) as views FROM `modx_site_content` AS `Ticket` LEFT JOIN `modx_site_content` `Section` ON `Section`.`id` = `Ticket`.`parent` LEFT JOIN `modx_users` `User` ON `User`.`id` = `Ticket`.`createdby` LEFT JOIN `modx_user_attributes` `Profile` ON `Profile`.`internalKey` = `User`.`id` LEFT JOIN `modx_tickets_votes` `Vote` ON `Vote`.`id` = `Ticket`.`id` AND `Vote`.`class` = "Ticket" AND `Vote`.`createdby` = 2 LEFT JOIN `modx_tickets_stars` `Star` ON `Star`.`id` = `Ticket`.`id` AND `Star`.`class` = "Ticket" AND `Star`.`createdby` = 2 LEFT JOIN `modx_tickets_views` `View` ON Ticket.id = View.parent WHERE  ( `Ticket`.`class_key` = 'Ticket' AND `Ticket`.`parent` IN (34,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191) AND `Ticket`.`published` = 1 AND `Ticket`.`deleted` = 0 )  GROUP BY Ticket.id ORDER BY views DESC LIMIT 8 "
0.0001249: SQL executed
0.0000591: Total rows: 107
0.0001259: Rows fetched
0.0003910: Returning raw data
0.0016451: Created inline chunk with name "8bf4cd4b7262b14ab2057e2f04ce31f4"
0.0130310: Returning processed chunks
0.0175960: Total time
12 320 768: Memory usage
21 сентября 2015, 07:57
0
Интересно, почему твой код у меня выводит только [[+views]], а остальные плейсхолдеры не видит, как будто не выбрал их. То есть никакие [[+uri]] и [[+pagetitle]] не выводятся!
18 сентября 2015, 13:35
0
Хотелось бы знать, ведутся ли хоть какие-то работы по доработке компонента?
Некоторые хотелки были высказаны выше. Мне же прямо сейчас не хватает поиска-замены не строчки, а нескольких строчек сразу.
Понимаю что это сложно и вероятно ненужно, но кнопка «Открыть чанк» в новой вкладке очень нужен. Сейчас нету ссылки на сам чанк из результатов поиска, чтобы можно было его отредактировать. При большом количестве результатов и при необходимости изменять сразу несколько строк, это становится критичным…
17 сентября 2015, 18:33
0
И как решил задачу?
17 сентября 2015, 13:35
0
Нда, магия..

Значит что-то где-то у меня.
А может быть это потому что mFilter2 у тебя работает с минишоповскими брендами, а у меня по тв-шкам? (хотя это тоже бред, работать должно однозначно).
Спасибо за помощь, и вообще, СПАСИБО ЗА ПРИМЕР СОБСТВЕННОЙ МАРШРУТИЗАЦИИ!
17 сентября 2015, 13:16
0
В том-то и дело, что все нужные мне переменные я выставил в GET PHP, но глюки всё равно имели место…
Вот место как они выставляются у меня:
$_GET[$filter] = $_REQUEST[$filter] = $name;
        $_GET['parents'] = $_REQUEST['parents'] = $categoryId;
Но работают они только на первой странице с ajax-ом…

Вот весь код плагина, если нужно(там у меня идёт выборка тв-шек, их транслитерация, сравнивание транслита с урлом и т.д.):
<?php
ini_set("display_errors",1);
error_reporting(E_ALL);
if ($modx->event->name != 'OnPageNotFound') {return false;}
$alias = $modx->context->getOption('request_param_alias', 'q');
if (!isset($_REQUEST[$alias])) {return false;}

$request = $_REQUEST[$alias];
$tmp = explode('/', $request);

if (count($tmp) >= 2) {
    
	if (!$section = $modx->findResource($tmp[0] . '/')) {
		return false;
	}
	
    $tmp2 = explode('_', $tmp[2]);
    $filter = $tmp2[0];
	$name = str_replace('.html', '', $tmp2[1]);
	
	if ($tmp2[1] != $name || (isset($tmp[2]) && $tmp[2] == '')) {
		$modx->sendRedirect($tmp[0] . '/' .$filter.'_'.$name);
	}

	if ($fltr = $modx->getObject('modTemplateVar', array('name' => $filter))) {

        $rus = array('А','Б','В','Г','Д','Е','Ё','Ж','З','И','Й','К','Л','М','Н','О','П','Р','С','Т','У','Ф','Х','Ц','Ч','Ш','Щ','Ъ','Ы','Ь','Э','Ю','Я','а','б','в','г','д','е','ё','ж','з','и','й','к','л','м','н','о','п','р','с','т','у','ф','х','ц','ч','ш','щ','ъ','ы','ь','э','ю','я',' ');
        $lat = array('a','b','v','g','d','e','e','gh','z','i','y','k','l','m','n','o','p','r','s','t','u','f','h','c','ch','sh','sch','y','y','y','e','yu','ya','a','b','v','g','d','e','e','gh','z','i','y','k','l','m','n','o','p','r','s','t','u','f','h','c','ch','sh','sch','y','y','y','e','yu','ya','-');
    
        $in=$modx->runSnippet('msProducts', array('limit'=>'0', 'returnIds'=>'1'));
        $in = explode(",", $in);

    
        $tv = $modx->getObject('modTemplateVar', array('name' => $filter));
        $tv_name = $tv->get('name');
        $tv_desc = $tv->get('description');
        $tv_id = $tv->get('id');
        
        $q = $modx->newQuery('modTemplateVarResource');
        $q->where(array('tmplvarid' => $tv_id));
        $q->where(array('contentid:IN' => $in));
        $q->sortby('value', 'ASC');
        $q->select(array('DISTINCT modTemplateVarResource.value'));
        $q->prepare();
        $q->stmt->execute();
        $recipe = $q->stmt->fetchAll(PDO::FETCH_ASSOC);
    
        $arr = array();
        foreach($recipe as $r)
        {
            $rarr = explode("||", $r['value']);
            foreach($rarr as $r2)
            {
                $arr[] = $r2;
            }
    
        }
        $arr = array_unique($arr);
        if (!empty($arr)){
            foreach($arr as $a) {
                $latina = str_replace($rus, $lat, $a);
                if($latina == $name) {
                    $name = $a;
                    $modx->setPlaceholder('pagetitle', $tv_desc.': '.$name);
                    break;
                }
            }
        }



        
        $_GET[$filter] = $_REQUEST[$filter] = $name;

        $categoryId = $modx->findResource($tmp[0] .'/'.$tmp[1].'/');
        $cat = $modx->getObject('modResource', $categoryId);
        $cattitle = $cat->get('pagetitle');
        $caturl = $modx->makeUrl($categoryId);

        $_GET['parents'] = $_REQUEST['parents'] = $categoryId;

		$modx->setPlaceholder('longtitle', $parentId.$tv_desc.': '.$name);
		$modx->setPlaceholder('category.title', $cattitle);
		$modx->setPlaceholder('category.link', $caturl);
		$modx->setPlaceholder('category.id', $categoryId);
		$modx->setPlaceholder('category.fltr', $name);

		$modx->sendForward($section);

	}
}
17 сентября 2015, 10:53
0
Нужно в чанке tpl.mFilter2.outer удалить id=«mse2_pagination»
17 сентября 2015, 10:52
0
Получилось убрать ajax-пагинацию просто убрав у списка ul в чанке tpl.mFilter2.outer следующее:
id="mse2_pagination"
Теперь пагинация стала стандартной, с перезагрузкой и добавляет к параметрам в адресной строке и название параметра, например вот так:
/catalog/category/strana_franciya?page=2&strana=franciya