Skip to content

Instantly share code, notes, and snippets.

@pavel-one
Created May 12, 2018 04:31
Show Gist options
  • Select an option

  • Save pavel-one/9ec3d57cf539e5841afee7aee7724e8f to your computer and use it in GitHub Desktop.

Select an option

Save pavel-one/9ec3d57cf539e5841afee7aee7724e8f to your computer and use it in GitHub Desktop.

Revisions

  1. pavel-one created this gist May 12, 2018.
    24 changes: 24 additions & 0 deletions getTVcustomData.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    <?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;