【发布时间】:2015-07-31 04:37:54
【问题描述】:
我在 joomla 3.4 中有一个模块,可以为某些产品创建一个 jquery 价格范围滑块。它使用 ajax 加载结果,但是分页没有被加载,所以如果有超过 40 个结果(我的分页限制),那么只有前 40 个被呈现,没有办法在没有分页的情况下看到其余的。如果有分页,我怎样才能让它显示分页?分页必须是正常的而不是ajax。
这是模块的代码
<?php
//some code here to calculate $min and $max values of price range
//some code here to add component parameters in the $url variable
//below the final part of the $url variable, as you can see it has tmpl=component which prevents the pagination from being loaded. If I remove the tmpl=component part then I get an internal server error 500
$url .='&format=raw&ajax=1&tmpl=component';
?>
<script>
jQuery(function() {
jQuery( "#slider-range" ).slider({
range: true,
min: <?php echo $min;?>,
max: <?php echo $max;?>,
values: [ <?php echo $min;?>,<?php echo $max;?> ],
slide: function( event, ui ) {
jQuery( "#slider-text" ).text( "From " + ui.values[ 0 ] + " to " + ui.values[ 1 ] +' Euro');
},
stop: function( event, ui ) {
url='<?php echo $url?>'+'&min='+ui.values[ 0 ]+'&max='+ui.values[ 1 ];
jQuery('#com_datafeeds').prepend('<img style="display: block; margin:auto" src="<?php echo JURI::base(); ? >/components/com_datafeeds/assets/images/ajax-loader.gif" />');
jQuery.get(url, function(data) {
if( data) {jQuery('#com_datafeeds').html( data);
} else {
jQuery('#com_datafeeds').html('<h2>No product found for this price range</h2>');
}
});
}
});
jQuery( "#amount" ).val( "van " + jQuery( "#slider-range" ).slider( "values", 0 ) +
" tot " + jQuery( "#slider-range" ).slider( "values", 1 ) + ' Euro');
});
</script>
<div style="width:50%;margin:0px auto" id="slider-text"><?php echo "From $min to $max Euro";?></div>
<div style="width:50%;margin:0px auto" id="slider-range"></div>
【问题讨论】:
标签: php jquery ajax joomla pagination