Food diary

Hi all,

I’m creating a food diary and I want to display meals in a 7 column format… one column for each day of the week.

So for example, it would look something like this…




Monday    Tuesday    Wednesday    Thursday    Friday    Saturday    Sunday

Meal 1    Meal 3     Meal 6       Meal 7      Meal 9    Meal 11     Meal 14

Meal 2    Meal 4                  Meal 8      Meal 10   Meal 12

          Meal 5                                        Meal 13



I am relatively new to Yii so not sure about the best way to do this. My initial thoughts were to create 7 different dataproviders and use them in 7 different CListView widgets. Each dataprovider will contain only the meals for 1 day. I would then display each CListView widget as nicely as possible into a column format.

Does this sound like a good way to do it?

Any help would be much appreciated.

Cheers

Tom

P.S. I don’t need pagination.

If you don’t need pagination and sorting, don’t use dataprovider.

Simply get the models with modelNAme::model()->findAll($criteria), make some cycles and display what do you need.

CActiveDataProvider, ClistView, CGridView are powerful instrument for easy support sort and paging, if thoose feature are not needed, therefore those powerful (and expensive) tools should not be used.

Makes sense. Thanks a lot!