Northie Reply #1, 5 months, 3 weeks ago
using
MODx 2.0.8
getResources 1.4.0
PHP 5.3.8
MySQL 5.0.77
Hi, While on page with id 22 I have this call to getResourses:
This does not output anything, so I added the debug parameter and looked at the SQL, which is
running this in mysql does not produce any errors, so I analysed the SQL and saw this part
The resources I'm trying to include have various different parents, but all have a TV of 'Service' with a value like 'Website Design'
If I take out that one line of the SQL, and run the query, I get the results I expect.
Back to the Docs
Even though I'm not specifying a list of resources I tried adding &parents=`-1` anyway - same result - an empty set as the SQL had in it
So, the question really is this:
How can I use getResources to pull back pages filtered by template values only (ie omiting parents and resources)?
Is this even possible?
MODx 2.0.8
getResources 1.4.0
PHP 5.3.8
MySQL 5.0.77
Hi, While on page with id 22 I have this call to getResourses:
[[!getResources? &tpl=`featuredWork` &includeTVs=`1` &processTVs=`1` &tvFilters=`Service==%Website Design%` ]]
This does not output anything, so I added the debug parameter and looked at the SQL, which is
SELECT `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`.`haskeywords`, `modResource`.`hasmetatags`, `modResource`.`privateweb`, `modResource`.`privatemgr`, `modResource`.`content_dispo`, `modResource`.`hidemenu`, `modResource`.`class_key`, `modResource`.`context_key`, `modResource`.`content_type` FROM `modx_site_content` AS `modResource` WHERE ( ( modResource.parent IN (22) AND `modResource`.`deleted` = 0 AND `modResource`.`published` = 1 AND `modResource`.`hidemenu` = 0 ) AND EXISTS ( SELECT 1 FROM `modx_site_tmplvar_contentvalues` tvr JOIN `modx_site_tmplvars` tv ON tvr.value LIKE '%Website Design%' AND tv.name = 'Service' AND tv.id = tvr.tmplvarid WHERE tvr.contentid = modResource.id ) ) ORDER BY publishedon DESC LIMIT 5
running this in mysql does not produce any errors, so I analysed the SQL and saw this part
....modResource.parent IN (22) AND...
The resources I'm trying to include have various different parents, but all have a TV of 'Service' with a value like 'Website Design'
If I take out that one line of the SQL, and run the query, I get the results I expect.
Back to the Docs
parents : Comma-delimited list of ids serving as parents. Use -1 to ignore parents when specifying resources to include.
Even though I'm not specifying a list of resources I tried adding &parents=`-1` anyway - same result - an empty set as the SQL had
....modResource.parent IN (-1) AND...
So, the question really is this:
How can I use getResources to pull back pages filtered by template values only (ie omiting parents and resources)?
Is this even possible?
