Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Filter Fields Settings
- $filter = array();
- //Sort
- if($_GET['sortby']) {
- $sortby = $_GET['sortby'];
- } else {
- $sortby = 'pagetitle';
- }
- if($_GET['sortdir']) {
- $sortdir = $_GET['sortdir'];
- } else {
- $sortdir = 'asc';
- }
- //End Sort
- //Offset
- $offset = 0;
- if($_GET['offset']){
- $offset = $_GET['offset'];
- }
- if($filter) {
- $where = $modx->toJSON(array($filter));
- } else {
- $where = '';
- }
- $params_count = array(
- 'parents' => $parents,
- 'limit' => 0,
- 'tpl' => '@INLINE ,',
- 'select' => 'id',
- 'includeTVs' => $fields,
- 'showHidden' => '1',
- 'where' => $where
- );
- $count = $modx->runSnippet('pdoResources',$params_count);
- $count = count(explode(',',$count))-1;
- $modx->setPlaceholder('count',$count);
- $params = array(
- 'parents' => $parents,
- 'limit' => $limit,
- 'offset' => $offset,
- 'tpl' => $tpl,
- 'tplFirst' => $tplFirst,
- 'select' => 'id,pagetitle,introtext,content',
- 'includeTVs' => $fields,
- 'showHidden' => '1',
- 'sortby' => $sortby,
- 'sortdir' => $sortdir,
- 'where' => $where
- );
- $more = $count - $offset - $limit;
- $lim = $more > $limit ? $limit : $more;
- $button = '';
- if($more > 0){
- $button = '<div class="ajax-filter-count load_more" data-count="'.$count.'"><a href="#" class="ajax-more load_more_link rect_link">Загрузить еще</a></div>';
- }
- return $modx->runSnippet('pdoResources',$params).$button;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement