Skip to content

Instantly share code, notes, and snippets.

@sashabeep
Last active June 9, 2020 09:03
Show Gist options
  • Save sashabeep/6779969d349f80ea4a23fa826850cdb4 to your computer and use it in GitHub Desktop.
Save sashabeep/6779969d349f80ea4a23fa826850cdb4 to your computer and use it in GitHub Desktop.
docLister latest news from subfolders
[[oneLatestResByParent]]
<?php
if (!function_exists('show_latest')) {
function show_latest() {
global $modx;
$output = '';
$table = $modx->getFullTableName('site_content');
$result = $modx->db->select('id, parent', $table, '(parent=61 OR parent=63 OR parent=64) AND deleted=0 AND published=1', 'pub_date ASC, createdon ASC', '');
$members = $modx->db->makeArray( $result );
$struct = [];
foreach( $members as $p_val ) {
$struct[$p_val['parent']] = $p_val['id'];
}
return implode(',', $struct);
}
}
return show_latest();
tplHomePage
[[DocLister?
&sortType=`doclist`
&documents=`[[oneLatestResByParent]]`
&tvPrefix=``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment