Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yii CListView with <ul> tag

I am trying to use a theme for my yii application. for listing the projects for portfolio section I'm using CListView. in the template it uses lists (<ul> and <li> tags) to show the portfolio elements, and since I didn't want to go through all files and jquery stuff I wanted to do the same. but CListView adds some div tags by default.. I need to know if there are any configurations for CListView to use <ul> tag instead of <div> and also set the class for it?

here is what I have:

<ul class="clearfix port-det port-thumb">
     <?php
          $this->widget('zii.widgets.CListView', array(
                'dataProvider'=>$dataProvider,
                      'itemView'=>'_view',
         ));
     ?>
</ul>

and in _view.php:

<li data-id="web print" class="clearfix">
  ...
</li>

and the HTML code I get in the end is something like this:

<ul class="clearfix port-det port-thumb">
   <div id="yw0" class="list-view">
      <div class="summary">Displaying 1-8 of 9 result(s).</div>
      <div class="items">
          <li class="clearfix" data-id="web print">
            ...
          </li>
      </div>
   <div>
</ul>

Update: and I need something like this:

<ul class="clearfix port-det port-thumb"> 
          <li class="clearfix" data-id="web print">
            ...
          </li>
</ul>
like image 987
mahsa.teimourikia Avatar asked Nov 15 '12 14:11

mahsa.teimourikia


1 Answers

As I can see there is no need to extend CListView. You can set its itemsTagName and itemsCssClass:

<?php
    $this->widget('zii.widgets.CListView', array(
        'dataProvider'=>$dataProvider,
        'itemView'=>'_view',
        'itemsTagName'=>'ul',
        'itemsCssClass'=>'clearfix port-det port-thumb'
    ));
?>
like image 168
ezze Avatar answered Oct 14 '22 14:10

ezze