-
-
Save ideesimple/715214 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* build a query to get Resources with a given parent that are published and not deleted */ | |
$query = $modx->newQuery('modResource', array('parent' => $idRessource, 'deleted' => false, 'published' => true)); | |
/* to optimize, you can select only the columns you need */ | |
// $query->select($modx->getSelectColumns('modResource', 'modResource', '', array('id', 'class_key', 'context_key'))); | |
/* get the modResource objects with the given parent */ | |
$children = $modx->getCollection('modResource', $query); | |
/* loop through the children and push the id onto $resourceIds */ | |
$resourceIds = ""; | |
$i=0; | |
foreach ($children as $child) { | |
if ($i!=0) { | |
$resourceIds .= "||"; | |
} | |
$resourceIds .= $child->get('pagetitle'); | |
$resourceIds .= "=="; | |
$resourceIds .= $child->get('id'); | |
$i++; | |
} | |
return $resourceIds; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@EVAL return $modx->runSnippet('getAside',array("idRessource" =>"147")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Don't forget to set Ouput Type as Delimiter «,» in order to be able to use the ouput in a getResources call |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment