Дмитрий Кондаков

Дмитрий Кондаков

С нами с 28 февраля 2013; Место в рейтинге пользователей: #231
Дмитрий Кондаков
24 августа 2015, 17:45
+2
Попробуйте так:
<?php
$tv = $modx->getObject('modTemplateVar', array('name' => $name));
$elements = $tv->get('elements');
$element = explode('||', $elements);
foreach($element as $e) {
  list($elName,$elId) = explode("==", $e);
  echo '<option value="'.$elId.'">'.$elName.'</option>';
}
Дмитрий Кондаков
24 августа 2015, 17:38
0
Что-то Вы напутали, этот сниппет выводит одно конкретное значение.
Дмитрий Кондаков
19 августа 2015, 12:33
0
Ну незнаю, у меня кроме AjaxManager'а проблем вроде нет, хотя сайт не маленький и пакетов установлено много
Дмитрий Кондаков
19 августа 2015, 11:58
0
C этим ладно, обновил сейчас ms2gallery до последней версии, тоже похожие проблемы начались, только левая панель и верхнее меню отображается, вот ошибка в консоли:

до этого стояла версия 1.3.2-pl2
Дмитрий Кондаков
19 августа 2015, 11:35
0
Обновился до 2.4.0, AjaxManager стал глючить, у всех так или только у меня?
Дмитрий Кондаков
28 июля 2015, 17:10
0
Тестирую все варианты на скорость)
Дмитрий Кондаков
28 июля 2015, 14:20
0
Понятно, и можно будет как-то оптимизировать при росте просмотров?
Дмитрий Кондаков
28 июля 2015, 13:30
+1
Спасибо за подсказку, получилось. Если кому понадобится вот джоины:
&leftJoin=`{
        "View": {
          "class":"TicketView",
          "alias":"View", 
          "on": "modResource.id = View.parent"
        },
        "Thread": {
          "class":"TicketThread",
          "alias":"Thread", 
          "on": "modResource.id = Thread.resource"
        }
      }`
  &select=`{
		"modResource": "*",
		"View": "COUNT(View.parent) as views",
		"Thread": "comments"
	}`
По скорости да, предполагаю что будет медленно с большим количеством ресурсов и комментариев, но пока особо не ощутимо. Мне главное сейчас было научиться и понять как это работает)
Кстати а как быстрее? Выводить своим сниппетом в чанке?
Дмитрий Кондаков
28 июля 2015, 13:14
0
Сниппетом не проблема, хочу научиться именно джоином
Дмитрий Кондаков
16 июля 2015, 09:09
0
Кто знает почему сортировка может неверно отрабатывать? Вот пример сортировка по просмотрам по убыванию:
707,758,702,608,268,261,699,228,856
Лог
0.0001590: Query parameters are prepared.
0.0000389: xPDO query object created
0.0001910: leftJoined TicketsSection as Section
0.0001500: leftJoined modUser as User
0.0001700: leftJoined modUserProfile as Profile
0.0004919: leftJoined TicketVote as Vote
0.0004439: leftJoined TicketStar as Star
0.0004671: leftJoined TicketView as View
0.0000041: Grouped by Ticket.id
0.0000641: 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.0000160: Added selection of modUser: `username`
0.0000272: 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.0001359: 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.0000188: Added selection of TicketVote: `value` as `vote`
0.0000792: Added selection of TicketStar: COUNT(`id`) as `star`
0.0000420: Added selection of TicketView: COUNT(View.parent) as views
0.0023339: Processed additional conditions
0.0026202: Added where condition: class_key=Ticket, Ticket.parent:IN(11,176,49632,49920,49921,50126,49628,49672,49673,49674,49676,49677,49678,49679,49680,49712,49848,49908,50038,50065,50192,49681,49682,49683,49684,49685,49686,49689,49690,49691,49693,49694,49695,49696,49697,49698,49699,49700,49701,49702,49704,49705,49706,49707,49709,49710,49711,49722,49723,49727,49728,49731,49733,49737,49738,49740,49741,49744,49745,49746,49749,49750,49751,49752,49753,49754,49756,49757,49778,49780,49790,49796,49801,49802,49803,49804,49805,49808,49843,49849,49851,49854,49855,49856,49860,49861,49864,49875,49876,49878,49844,49850,49845,49846,49847,49909,49910,49912,49919,49927,49931,49937,49948,49964,49993,50006,50008,49907,50039,50040,50043,50060,50025,50066,50073,50074,50086,50100,50101,50102,50123,50125,50142,50193,50197,50211,50214,50128,50129), Ticket.published=1, Ticket.deleted=0
0.0000479: Sorted by views, DESC
0.0000050: Limited to 9, offset 0
0.0004919: 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` = 1 LEFT JOIN `modx_tickets_stars` `Star` ON `Star`.`id` = `Ticket`.`id` AND `Star`.`class` = "Ticket" AND `Star`.`createdby` = 1 LEFT JOIN `modx_tickets_views` `View` ON Ticket.id = View.parent WHERE  ( `Ticket`.`class_key` = 'Ticket' AND `Ticket`.`parent` IN (11,176,49632,49920,49921,50126,49628,49672,49673,49674,49676,49677,49678,49679,49680,49712,49848,49908,50038,50065,50192,49681,49682,49683,49684,49685,49686,49689,49690,49691,49693,49694,49695,49696,49697,49698,49699,49700,49701,49702,49704,49705,49706,49707,49709,49710,49711,49722,49723,49727,49728,49731,49733,49737,49738,49740,49741,49744,49745,49746,49749,49750,49751,49752,49753,49754,49756,49757,49778,49780,49790,49796,49801,49802,49803,49804,49805,49808,49843,49849,49851,49854,49855,49856,49860,49861,49864,49875,49876,49878,49844,49850,49845,49846,49847,49909,49910,49912,49919,49927,49931,49937,49948,49964,49993,50006,50008,49907,50039,50040,50043,50060,50025,50066,50073,50074,50086,50100,50101,50102,50123,50125,50142,50193,50197,50211,50214,50128,50129) AND `Ticket`.`published` = 1 AND `Ticket`.`deleted` = 0 )  GROUP BY Ticket.id ORDER BY views DESC LIMIT 9 "
0.3498919: SQL executed
0.0001910: Total rows: 113
0.0002520: Rows fetched
0.0007212: Returning raw data
0.0163229: Created inline chunk with name "2332b555c97df802cbd2faaacae37ddc"
0.0950820: Returning processed chunks
0.4688890: Total time
23 855 104: Memory usage
Вызываю так:
[[!getTickets? 
      &tpl=`@INLINE <p><a href="[[+uri]]">[[+pagetitle]] ([[+views]])</a></p>` 
      &parents=`11` 
      &leftJoin=`{
        "View": {
          "class":"TicketView",
          "alias":"View", 
          "on": "Ticket.id = View.parent"
          }
        }`
      &select=`{
        "Ticket":"*",
        "View": "COUNT(View.parent) as views"
      }`
      &sortby=`views`
      &groupby=`Ticket.id`
      &showLog=`1`
      &sortdir=`DESC`
      &limit=`9`
    ]]
Дмитрий Кондаков
01 июля 2015, 10:24
0
Огромное спасибо, нашел! json строка в TV хранилась, забыл совсем про неё)
Дмитрий Кондаков
01 июля 2015, 09:32
+1
Все правильно, это относительные ссылки. Чтобы все ссылки стали абсолютыми, можно в настройках — link_tag_scheme выставить full
Дмитрий Кондаков
01 июля 2015, 08:41
0
Так и не решили проблему? Обнаружил такую же проблему на одном из сайтов
Дмитрий Кондаков
01 июля 2015, 07:35
0
Виталий, если не сложно, к поиску по чанкам и шаблонам еще страницы сможешь добавить? Хотя бы поле [[*content]]
PS: очень помогло наличие «Поиск и замена» в компоненте, при переходе на fenom, не пришлось руками править около двух сотен чанков и шаблонов)