Доброе утро ребята.
хочу протестировать в консоли вот такой снипет, как сделать вывод на экран? запускаю а у меня на экране пусто
<?php
if (!empty($parents) && $parents > 0) {
if (empty($depth)) {$depth = 10;}
$pids = array_map('trim', explode(',', $parents));
$parents = $pids;
foreach ($pids as $v) {
if (!is_numeric($v)) {continue;}
$parents = array_merge($parents, $modx->getChildIds($v, $depth));
}
}
$output = null;
$q = $modx->newQuery('msProductFile', array('type' => 'image', 'parent' => 0));
$q->innerJoin('msProduct', 'msProduct', '`msProductFile`.`product_id` = `msProduct`.`id`');
$q->select('`msProductFile`.`id`, `msProductFile`.`url`, `msProductFile`.`product_id`, `msProduct`.`pagetitle`');
if (!empty($parents)) {
$q->where(array('`msProduct`.`parent`:IN' => $parents));
}
if ($q->prepare() && $q->stmt->execute()) {
while ($image = $q->stmt->fetch(PDO::FETCH_ASSOC)) {
$output .= '<a href="'.$image['url'].'" rel="prettyPhoto['.$image['product_id'].']" title="'.$image['pagetitle'].'"></a>'."\n";
}
}
return $output;