classYour_Module_Block_Entityname_ListextendsMage_Core_Block_Template
{ protected function _construct(){
     // We get our collection through our model
parent::_construct();
     // Instantiate a new Pager block
$this->_entities =Mage::getModel('your_module/entityname')->getCollection()->setOrder('created_at', 'desc');
     // /!\ The limit must be set before the collection
$pager =newMage_Page_Block_Html_Pager();// We set our limit (here an integer store in configuration).
     // Add our Pager block to our current list block
$pager
->setLimit((int)Mage::getStoreConfig('your_module/entityname/pagination'))->setCollection($this->_entities);
$this->setChild('pager', $pager);
}
}

You just need now to include the call in your template (phtml) file :

<divclass="your_module_entities">
  <?php foreach($this->_entities as $entity):?>
  <divclass="entity">
<h2>
<?php echo $entity->getAttribute1();?>
</h2>
<p>
<?php echo $entity->getAttribute2();?>
</p>
</div>
<?php endforeach;?></div><?php echo $this->getChildHtml('pager');?>
 

How to use pagination in Magento的更多相关文章

  1. pagination 分页

    <!DOCTYPE html> <html> <head> <title>pagination</title> <style type ...

  2. salesforce 零基础学习(四十九)自定义列表分页之使用Pagination实现分页效果 ※※※

    上篇内容为Pagination基类的封装,此篇接上篇内容描述如何调用Pagination基类. 首先先创建一个sObject,起名Company info,此object字段信息如下: 为了国际化考虑 ...

  3. salesforce 零基础学习(四十八)自定义列表分页之Pagination基类封装 ※※※

    我们知道,salesforce中系统标准列表页面提供了相应的分页功能,如果要使用其分页功能,可以访问http://www.cnblogs.com/zero-zyq/p/5343287.html查看相关 ...

  4. knockoutjs+ jquery pagination+asp.net web Api 实现无刷新列表页

    Knockoutjs 是一个微软前雇员开发的前端MVVM JS框架, 具体信息参考官网 http://knockoutjs.com/ Web API数据准备: 偷个懒数据结构和数据copy自官网实例  ...

  5. LNMP环境magento常见错误

    一.安装报404错误 git clone 下最新代码,跳转到index/install 安装时出现404错误 需要把伪静态规则加到nginx配置文件中: # # The default server ...

  6. Magento 新增字段的值读写丢失原因

    某实体新增字段handreturn_status,欲操作之: $order_info = Mage::getModel('sales/order')->load($order_id); //se ...

  7. MAGENTO - APACHE SOLR INTEGRATION - PART II (SETUP)

    MAGENTO - APACHE SOLR INTEGRATION - PART II (SETUP) Tue, 03/01/2011 - 18:30 Tweet Development E-Comm ...

  8. ajax pagination 布局刷新

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xht ...

  9. Magento学习第一课——目录结构介绍

    Magento学习第一课--目录结构介绍 一.Magento为何强大 Magento是在Zend框架基础上建立起来的,这点保证了代码的安全性及稳定性.选择Zend的原因有很多,但是最基本的是因为zen ...

随机推荐

  1. Oracle EBS-SQL (PO-17):检查供货比例不为100%.sql

    select           * from           apps.MRP_SOURCING_RULES msrwhere           organization_id=X.    a ...

  2. Oracle EBS-SQL (OM-1):查询订单发货明细.sql

    select mtrh.request_number                  发货单号,       mmt.transaction_date                  发货时间,  ...

  3. sed简单实例练习

    sedfile内容如下: Steve Blenheim:238-923-7366:95 Latham Lane, Easton, PA 83755:11/12/56:20300 Betty Boop: ...

  4. HDU1875 畅通工程再续 (并查集)

    畅通工程再续 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Subm ...

  5. hdu 1715 大菲波数_java

    用java的大数解决 import java.math.BigInteger; import java.util.Scanner; public class Main { public static ...

  6. C#泛型详解

    我们在编写程序时,经常遇到两个模块的功能非常相似,只是一个是处理int数据,另一个是处理string数据,或者其他自定义的数据类型,但我们没有办法,只能分别写多个方法处理每个数据类型,因为方法的参数类 ...

  7. Web服务器压力测试一例

    近期部门新上线一个服务,我们使用ab和locust分别测试 目前项目属于demo阶段,对访问量的支持不要求太高,我们暂且设定在500请求,20并发 工具介绍 ab ab全称为:Apache HTTP ...

  8. web api 上传

    using System.Net; using System.Net.Http; using System.Web; using System.Web.Http;   namespace FileUp ...

  9. mysql的面试试题

    1, mysql的复制原理以及流程. (1)先问基本原理流程,3个线程以及之间的关联. 答:Mysql复制的三个线程:主库线程,从库I/O线程,从库sql线程: 复制流程:(1)I/O线程向主库发出请 ...

  10. dom操作例子

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...