I use CListView to render content from an database by using models and CActiveDataprovider, which works well.
Now, there is some data which doesn’t exist in the database, but is available as an associative PHP array.
The Question now is: howto bring that data into the clistview?
I thought about different ways, but did not find a solution.
Is there a way to smuggle to data from the array to the CListView, like mapping to an “fake model” or creating an pseudo object - an object which looks like an CActiveDataprovider (but I don’t know, how to do)?
Or maybe I didn’t understood the documentation and there is something like an backdoor to bring the array data to the model/CListView?
Thank you, rall0r.
Have a look at this thread.
I’m not sure, if I understand the post completely.
I have an data-source array $source like:
It’s possible to add the values like: $source->Attr1
And i can use this array as dataprovider and the "columns"-option to "map"?
Is this correct?
…in this case the CListView will iterate trough the array?
Almost. You’ll need to use a CArrayDataProvider.
CArrayDataProvider - that looks very interesting (I never heard about that)
Thank you so much!
I should have written "have a look at this post" (not thread).
Now take into account this post