I'm using CActiveDataProvider to populate a webpage showing messages between users. I have a view php file that uses 'zii.widgets.CListView' in conjunction with the CActiveDataProvider.
I'm using a partial _item.php file to render each individual message. The thing is currently each message renders with solid line above each message, per specified by the _item.php file.
<hr style="border-bottom:solid 1px #efefef; border-top:solid 0px #fff;" />
I want to show this line only when the message being displayed previously is from a different user. I reason that to do this I need to be able to get information from the dataprovider about the previous item (or alternatively, the following item). How do I accomplish this?
What it looks like:
user 1: foobar blah blah
user 2: asdlkfj;ajd
user 2: aljs;dfjlkjk
What I want it to look like:
user 1: foobar blah blah
user 2: asdlkfj;ajd
user 2: aljs;dfjlkjk
This is what my controller looks like:
$dataProvider = new CActiveDataProvider('MailboxMessage', array(
'criteria' => array(
'condition' => 'conversation_id=:cid',
'params' => array(
':cid' => $_GET['id']
),
),
'sort' => array(
'defaultOrder' => 'created DESC' // this is it.
),
'pagination' => array('pageSize' =>20),
));