Answer the question
In order to leave comments, you need to log in
Why does this code cause modx to freeze?
I wrote this code:
$resources = $modx->getCollection('modResource', array('template' => 4));
var_dump($resources);
var_dump([1,2,3]);
, everything works. var_dump($resources);
does it freeze? How else can you output a variable in modx?
Answer the question
In order to leave comments, you need to log in
And how many resources do you have with pattern=4?
getCollection is generally gluttonous, because it selects objects with all the giblets.
as an option, try getIterator .. or narrow the number of objects to select, or better
$q = $modx->newQuery('modResource', array('template' => 4));
$q->select('id,pagetitle');
$q->prepare();
$q->stmt->execute();
$res = $q->stmt->fetchAll(PDO::FETCH_ASSOC);
var_dump($res);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question