douda5227 2014-01-24 21:06
浏览 66
已采纳

使用自定义HTML和CSS使用分页显示数据

Let's say I have a model that represents products in a catalog. The model supplies the content provider (CActiveDataProvider) to the view, which in turn uses it to display a grid (CGridView).

What I need is a custom way to display this data: custom next/previous page links, custom data presentation. Something along these lines:

<div class="pagination">
     <a class="arrows prev fl" href="#"><span class="icon"></span>back</a>
     <a class="arrows next fr" href="#">forward <span class="icon"></span></a>
</div>
<ul class="some class">
     <li class="item"><a href="#"><img src="image.jpg" width="100" height="200"/></a></li>
     <li class="item"><a href="#"><img src="image.jpg" width="100" height="200"/></a></li>
     <li class="item"><a href="#"><img src="image.jpg" width="100" height="200"/></a></li>
     <li class="item"><a href="#"><img src="image.jpg" width="100" height="200"/></a></li>
     <li class="item"><a href="#"><img src="image.jpg" width="100" height="200"/></a></li>
     <li class="item"><a href="#"><img src="image.jpg" width="100" height="200"/></a></li>
</ul>

What is the best way to do this? So far, I am considering the following:

  1. Use CGridView, but somehow customize its output using parameters.
  2. Create a class as a descendant of CGridView or even CBaseListView and put in the formatting logic in it.
  3. Just do it the quick and dirty way: simply iterate over items and echo the HTML.

Or maybe I am missing something here and there's a better way?

  • 写回答

2条回答 默认 最新

  • duanbi8089 2014-02-01 12:54
    关注

    I ended up creating my own class to display this data as a descendant of CWidget class. All the logic went into the run method.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法