getting data from dataprovider

Hi all,

I’m getting along with a web application. I have made a view which is working. Now I want to have a little custom blok on the left of my page. If I do it with cListView I get tons of stuff I don’t need. In text i want this:

HEADER

item

item

item

The header is a div with a class and the items too.

In my main.php of view I have a section with a clist view and a data provider A. This works. I have a data provider B, which if I call with a render(VIEW, ARRAY(‘dataB’ => $datapriderB) will get the data. A “print_r ($dataB->data);” in the called view shows all data and the data in my ‘item’ column.

How can I get the item data from the pass data provider B? I would expect something like, but it doesn’t work:




for each($dataB as $data) { echo $data->item} 

In stead I get "Trying to get property of non-object ". The data provider consists of TABLE a and TABLE b (just like the working other provider, but different tables). the ‘item’ is from table 2.

You kind of answered your own question, I think.


foreach($dataB->data as $data) { echo $data->item} 

should work.

I wonder what I missed.

I guess it’s what I did. I put a column from table b. THat said undefined variable. When I put a column from table A it worked, like you pointed out. So I put the table B name from the CDBCriteria from the ‘with’ after $data before the column and it works.

No to redo some CSS for that’s looping as well, I’ll get that.

Thanks for the speedy help.