I am using yii-attachment-behavior for image uploads. You can see all the comments I put in the comments of the extension if you want to use this. I’m not going to post the model portion for the attachement-behavior you can go to the ext. to see it.
<?php $this->widget('zii.widgets.CListView', array(
'model', //don't get this confused this is my 'name' column
<?php echo CHtml::link('<img src="../'.$data->getAttachment('thumb').'" />', array('view', 'id'=>$data->product_id)); ?><br>
<?php echo CHtml::link(CHtml::encode($data->company->name),array("companies/view","id"=>$data->company_id)); ?> <br>
<?php echo CHtml::link(CHtml::encode($data->model),array("products/view","id"=>$data->product_id)); ?>
EDIT: I changed this becuase I didn't have a set way to ensure the products
image size would render the size i wanted them to every time to make sure my
pretty css didn't get jacked up + it's on auto (see the css). It will not keep
proportions but it will show them in a set size. I didn't want to relie on someone's server to have the proper image stuff installed.
The alt portion is just in case it can't find the image or default image it
it shows those words so I know where to look for the problem and it doesn't
leave the screen blank.
$imagelink = '<img src="../'.$data->Attachment.'" style="width:270px;height:135px;" alt="Can\'t Find Product Image Directory" />';
echo CHtml::link($imagelink, array('view', 'id'=>$data->product_id)); ?><br>
<?php echo CHtml::link(CHtml::encode($data->name),array("products/view","id"=>$data->product_id)); ?> <br/>
public function search()
// Warning: Please modify the following code to remove attributes that
// should not be searched.
return new CActiveDataProvider($this, array(
'pageSize'=>'10', //could put 1, 2, 3, 10, 20, 30, etc. however many you want to display per page.
I’m letting the user select 10, 20, 30, 50 per page so my code if different but in your case if you only want 10 per page it is default so you can leave the portion above default gii. Or I believe that is how you make it preset value.
border:2px solid #f7f7f7;
border:10px solid #ffffff;
border-top:2px solid #f7f7f7;
filter:alpha(opacity=70); /* For IE8 and earlier */
Then of course you have to register the css in your theme/layouts/main.php
NOTE: My header and footer are in different files than the main.php so mine gets registered like this. Register yours how the other css are being registered at the top of your main.php. Or just add it to an existing css at the bottom.
Maybe that will help your or maybe someone else good luck!