Skip to content

Instantly share code, notes, and snippets.

@vgrish
Created September 5, 2013 08:05
Show Gist options
  • Save vgrish/6447284 to your computer and use it in GitHub Desktop.
Save vgrish/6447284 to your computer and use it in GitHub Desktop.
<script type="text/javascript" language="JavaScript">
jQuery(function($){
$('#results').load('[[~43]]', {
action: 'field33',
parents: '3',
page: '1',
limit: '10',
//offset: '0'
//where: '{"Data.favorite":"1"}'
});
});
</script>
<script type="text/javascript" language="JavaScript">
$(document).on('click', 'a.pagin', function(e) {
e.preventDefault();
var url = $(this).attr('href').replace("get?page=","");
jQuery(function($){
$('#results').load('[[~43]]', {
action: 'field33',
parents: '3',
page: url,
limit: '10',
//offset: '0'
//where: '{"Data.favorite":"1"}'
});
});
});
</script>
<div id="results"></div>
____________________________________43_________
<div class="pagination pagination-right">
<ul>
[[!+page.nav]]
</ul>
</div>
[[!get.param2? &tpl=`tpl.msProducts.row22` &includeContent=`1` &depth=`0`]]
<div class="pagination pagination-right">
<ul>
[[!+page.nav]]
</ul>
</div>
________________________get.param2_______________________
<?php
if ($_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') {return;}
$action = $_POST['action'];
if (empty($action)) {return;}
$res = '';
switch ($action) {
case 'field':
$param = array(
'parents' => (int)$_POST['parents'],
'limit' => (int)$_POST['limit'],
'offset' => (int)$_POST['offset'],
'where' => $_POST['where'],
'depth' => '2',
'resources' => (int)$_POST['resources'],
//'where' => '{"Data.favorite":"1"}',
'includeThumbs' => '92x92',
//'includeContent'=> $includeContent,
'tpl'=> $tpl,
'outputSeparator'=> $outputSeparator,
//'parents'=> '11',
//'limit'=> $limit,
'showUnpublished'=> '0',
'showDeleted'=> '0',
'showHidden'=> '0',
'totalVar'=> ''
);
$documents = $modx->runSnippet('msProducts',$param);
return $documents;
case 'field1':
$param = array(
'limit' => (int)$_POST['limit'],
'offset' => (int)$_POST['offset'],
//'display' => '40',
'depth' => $depth,
'parents' => (int)$_POST['parent'],
//'sysKey' => 'posts',
'includeContent'=> $includeContent,
'tpl'=> $tpl,
'outputSeparator'=> $outputSeparator,
//'parents'=> '11',
//'limit'=> $limit,
'showUnpublished'=> $showUnpublished,
'showDeleted'=> $showDeleted,
'showHidden'=> $showHidden
);
$documents = $modx->runSnippet('msProducts',$param);
return $documents;
case 'field33':
$param = array(
'element' => 'msProducts',
//'offset' => (int)$_POST['offset'],
//'limit' => (int)$_POST['limit'],
//'pageVarKey' => 'page',
//'page' => '11',
'depth' => $depth,
'parents' => (int)$_POST['parent'],
'includeContent'=> $includeContent,
'tpl'=> $tpl,
'outputSeparator'=> $outputSeparator,
//'parents'=> '11',
//'limit'=> $limit,
'showUnpublished'=> $showUnpublished,
'showDeleted'=> $showDeleted,
'showHidden'=> $showHidden,
'cache'=> 'true',
'cache_expires'=> '5000'
);
$documents = $modx->runSnippet('getPageExt',$param);
return $documents;
}
_____________________________________
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment