Skip to content

Instantly share code, notes, and snippets.

@pavel-one
Created May 12, 2018 04:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pavel-one/9ec3d57cf539e5841afee7aee7724e8f to your computer and use it in GitHub Desktop.
Save pavel-one/9ec3d57cf539e5841afee7aee7724e8f to your computer and use it in GitHub Desktop.
Кастомные данные для тв
<?php
//@EVAL return $modx->runSnippet('getDepartament');
$pdo = $modx->getService('pdoFetch');
$pdo->setConfig(array(
'parents' => 137,
'limit' => 0,
'sortby' => 'id',
'select' => 'id,pagetitle',
'return' => 'data',
'where' => [
'isfolder' => 1,
]
));
$arr = $pdo->run();
$outArr = array();
foreach ($arr as $item) {
$outArr[] = $item['pagetitle'].'=='.$item['id'];
}
$out = implode('||', $outArr);
return $out;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment