Last active
June 9, 2020 09:03
-
-
Save sashabeep/6779969d349f80ea4a23fa826850cdb4 to your computer and use it in GitHub Desktop.
docLister latest news from subfolders
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[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