Сортировка через pdoPage
Всем привет,
вывожу ресурсы через pdoPage
Спасибо Илье!!!
вывожу ресурсы через pdoPage
[[!pdoPage?
&parents=`2`
&depth=`1`
&hideContainers=`1`
&limit=`9`
&tpl=`preview`
&includeTVs=`actionVon,actionBis,foto_main`
&processTVs=`actionVon,actionBis`
&sortby=`RAND()`
]]
Как отсортировать чтобы не выводились ресурсы где createdby:userinfo=`fullname` пустой (пользователь удалился)?Спасибо Илье!!!
&select=`{
"modResource": "*",
"Profile": "*"
}`
&where=`{"Profile.fullname:!=":""}`
&leftJoin=`{ "Profile":{"class":"modUserProfile", "on":"modResource.createdby = Profile.internalKey"} }`
и ссылочки <a href="/[[+uri]]">Ссылка</a>
Комментарии: 12
Попробуй как-то так
&select=`{
"modResource": "*",
"Profile": "*"
}`
&where=`{"fullname:!=":""}`
&leftJoin=`{ "Profile":{"class":"modUserProfile", "on":"modResource.createdby = Profile.internalKey"} }`
Спс, но тогда вообще ничего не выводит.
А что покажет &showLog=`1`?
0.0000670: pdoTools loaded
0.0000150: xPDO query object created
0.0005109: Included list of tvs: actionBis, actionVon, foto_main
0.0041540: leftJoined modUserProfile as Profile
0.0001070: leftJoined modTemplateVarResource as TVactionbis
0.0001199: leftJoined modTemplateVarResource as TVactionvon
0.0000989: leftJoined modTemplateVarResource as TVfoto_main
0.0001221: Added selection of modResource: SQL_CALC_FOUND_ROWS `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.0001080: Added selection of modUserProfile: `id`, `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.0000072: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `tv.actionBis`
0.0000041: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `tv.actionVon`
0.0000041: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `tv.foto_main`
0.0000851: Replaced TV conditions
0.0005870: Processed additional conditions
0.0008502: Added where condition: fullname:!==, modResource.parent:IN(2,3,5,6,4,9,8,225,7,52,53,54,51,55,57,56,191,58), modResource.published=1, modResource.deleted=0, modResource.isfolder=0
0.0000360: Replaced TV conditions
0.0000830: Sorted by RAND(), DESC
0.0000029: Limited to 9, offset 0
0.0003111: SQL prepared "SELECT SQL_CALC_FOUND_ROWS `modResource`.`id`, `modResource`.`type`, `modResource`.`contentType`, `modResource`.`pagetitle`, `modResource`.`longtitle`, `modResource`.`description`, `modResource`.`alias`, `modResource`.`link_attributes`, `modResource`.`published`, `modResource`.`pub_date`, `modResource`.`unpub_date`, `modResource`.`parent`, `modResource`.`isfolder`, `modResource`.`introtext`, `modResource`.`content`, `modResource`.`richtext`, `modResource`.`template`, `modResource`.`menuindex`, `modResource`.`searchable`, `modResource`.`cacheable`, `modResource`.`createdby`, `modResource`.`createdon`, `modResource`.`editedby`, `modResource`.`editedon`, `modResource`.`deleted`, `modResource`.`deletedon`, `modResource`.`deletedby`, `modResource`.`publishedon`, `modResource`.`publishedby`, `modResource`.`menutitle`, `modResource`.`donthit`, `modResource`.`privateweb`, `modResource`.`privatemgr`, `modResource`.`content_dispo`, `modResource`.`hidemenu`, `modResource`.`class_key`, `modResource`.`context_key`, `modResource`.`content_type`, `modResource`.`uri`, `modResource`.`uri_override`, `modResource`.`hide_children_in_tree`, `modResource`.`show_in_tree`, `modResource`.`properties`, `Profile`.`id`, `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`, IFNULL(`TVactionbis`.`value`, '') AS `tv.actionBis`, IFNULL(`TVactionvon`.`value`, '') AS `tv.actionVon`, IFNULL(`TVfoto_main`.`value`, '') AS `tv.foto_main` FROM `modx_site_content` AS `modResource` LEFT JOIN `modx_user_attributes` `Profile` ON modResource.createdby = Profile.internalKey LEFT JOIN `modx_site_tmplvar_contentvalues` `TVactionbis` ON `TVactionbis`.`contentid` = `modResource`.`id` AND `TVactionbis`.`tmplvarid` = 22 LEFT JOIN `modx_site_tmplvar_contentvalues` `TVactionvon` ON `TVactionvon`.`contentid` = `modResource`.`id` AND `TVactionvon`.`tmplvarid` = 21 LEFT JOIN `modx_site_tmplvar_contentvalues` `TVfoto_main` ON `TVfoto_main`.`contentid` = `modResource`.`id` AND `TVfoto_main`.`tmplvarid` = 25 WHERE ( `modResource`.`fullname` != '' AND `modResource`.`parent` IN (2,3,5,6,4,9,8,225,7,52,53,54,51,55,57,56,191,58) AND `modResource`.`published` = 1 AND `modResource`.`deleted` = 0 AND `modResource`.`isfolder` = 0 ) ORDER BY RAND() DESC LIMIT 9 "
0.0024729: Could not process query, error #1054: Unknown column 'modResource.fullname' in 'where clause'
0.0091300: Total time
4 194 304: Memory usage
&where=`{"Profile.fullname:!=":""}`
также ничего не выводит. =/
Ну я не экстрасенс, showlog опять надо
ой, пардон.
0.0001080: pdoTools loaded
0.0000241: xPDO query object created
0.0006802: Included list of tvs: actionBis, actionVon, foto_main
0.0001979: leftJoined modTemplateVarResource as TVactionbis
0.0001638: leftJoined modTemplateVarResource as TVactionvon
0.0001640: leftJoined modTemplateVarResource as TVfoto_main
0.0001919: Added selection of modResource: SQL_CALC_FOUND_ROWS `id`, `type`, `contentType`, `pagetitle`, `longtitle`, `description`, `alias`, `link_attributes`, `published`, `pub_date`, `unpub_date`, `parent`, `isfolder`, `introtext`, `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.0000091: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `tv.actionBis`
0.0000060: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `tv.actionVon`
0.0000060: Added selection of modTemplateVarResource: IFNULL(`value`, '') AS `tv.foto_main`
0.0001369: Replaced TV conditions
0.0007019: Processed additional conditions
0.0010691: Added where condition: Profile.fullname:!==, modResource.parent:IN(2,3,5,6,4,9,8,225,7,52,53,54,51,55,57,56,191,58), modResource.published=1, modResource.deleted=0, modResource.isfolder=0
0.0000300: Replaced TV conditions
0.0000880: Sorted by RAND(), DESC
0.0000041: Limited to 9, offset 0
0.0004079: SQL prepared "SELECT SQL_CALC_FOUND_ROWS `modResource`.`id`, `modResource`.`type`, `modResource`.`contentType`, `modResource`.`pagetitle`, `modResource`.`longtitle`, `modResource`.`description`, `modResource`.`alias`, `modResource`.`link_attributes`, `modResource`.`published`, `modResource`.`pub_date`, `modResource`.`unpub_date`, `modResource`.`parent`, `modResource`.`isfolder`, `modResource`.`introtext`, `modResource`.`richtext`, `modResource`.`template`, `modResource`.`menuindex`, `modResource`.`searchable`, `modResource`.`cacheable`, `modResource`.`createdby`, `modResource`.`createdon`, `modResource`.`editedby`, `modResource`.`editedon`, `modResource`.`deleted`, `modResource`.`deletedon`, `modResource`.`deletedby`, `modResource`.`publishedon`, `modResource`.`publishedby`, `modResource`.`menutitle`, `modResource`.`donthit`, `modResource`.`privateweb`, `modResource`.`privatemgr`, `modResource`.`content_dispo`, `modResource`.`hidemenu`, `modResource`.`class_key`, `modResource`.`context_key`, `modResource`.`content_type`, `modResource`.`uri`, `modResource`.`uri_override`, `modResource`.`hide_children_in_tree`, `modResource`.`show_in_tree`, `modResource`.`properties`, IFNULL(`TVactionbis`.`value`, '') AS `tv.actionBis`, IFNULL(`TVactionvon`.`value`, '') AS `tv.actionVon`, IFNULL(`TVfoto_main`.`value`, '') AS `tv.foto_main` FROM `modx_site_content` AS `modResource` LEFT JOIN `modx_site_tmplvar_contentvalues` `TVactionbis` ON `TVactionbis`.`contentid` = `modResource`.`id` AND `TVactionbis`.`tmplvarid` = 22 LEFT JOIN `modx_site_tmplvar_contentvalues` `TVactionvon` ON `TVactionvon`.`contentid` = `modResource`.`id` AND `TVactionvon`.`tmplvarid` = 21 LEFT JOIN `modx_site_tmplvar_contentvalues` `TVfoto_main` ON `TVfoto_main`.`contentid` = `modResource`.`id` AND `TVfoto_main`.`tmplvarid` = 25 WHERE ( `Profile`.`fullname` != '' AND `modResource`.`parent` IN (2,3,5,6,4,9,8,225,7,52,53,54,51,55,57,56,191,58) AND `modResource`.`published` = 1 AND `modResource`.`deleted` = 0 AND `modResource`.`isfolder` = 0 ) ORDER BY RAND() DESC LIMIT 9 "
0.0038950: Could not process query, error #1054: Unknown column 'Profile.fullname' in 'where clause'
0.0072079: Total time
4 194 304: Memory usage
А Profile куда делся? Остальное-то не надо удалять
&select=`{
"modResource": "*",
"Profile": "*"
}`
&where=`{"Profile.fullname:!=":""}`
&leftJoin=`{ "Profile":{"class":"modUserProfile", "on":"modResource.createdby = Profile.internalKey"} }`
Всё работает как часики, ОГРОМНОЕ спасибо!
P.S. У тебя классные статьи на блоге.
P.S. У тебя классные статьи на блоге.
Интересно, что выводит всё как надо, но ссылки не раборают =)
ссылка типа
ссылка типа
<a href="[[~[[+id]]]]">ссылка</а>
<a href="/[[+uri]]">Ссылка</a>
поняно
Авторизуйтесь или зарегистрируйтесь, чтобы оставлять комментарии.