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:
- Use
CGridView
, but somehow customize its output using parameters. - Create a class as a descendant of
CGridView
or evenCBaseListView
and put in the formatting logic in it. - 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?