This kind of view is often a good candidate for "first-run" information. If you know that empty data will predominately occur for new users you can use the blank page to display suggestions and instructions about how to get started.
For example: In my file manager application, an empty folder will contain a short text suggesting the user uploads some files into it. /Martin On Oct 11, 8:04 pm, DigitalDude <[email protected]> wrote: > Hey, > > today I was wondering about how I could deal with an index-view where > no data is available. The main point I'm trying to demonstrate here is > the following scenario: > > In index-views, commonly we have let's say a table where the data we > grab from our tables is displayed. But when a user just registered for > your app, there won't be any data to display. In this case, there > would be an EMPTY table and that looks really bad in my opinion. > > I think in this case it would be better if there would be NO TABLE and > instead, there should be a message like "Currently you have no entries > in this category. Add some data by clicking this link...!" > > So what I mean is, there should be a check if there is any data to > display, and if NOT, a message like the one above should be printed. > > But what's the best practice for that? I figured out two > possibilities, but I'm not quite sure if it's really the perfect > way... > > 1. > We could use two elements; one where the message is displayed, and one > where the data is displayed (for example in a table or so...) > I would do the following check: > > if($somedata) { > echo $this->renderElement('DataShowElement');} else { > > echo $this->renderElement('EmptyDataMessage'); > > } > > 2. > pretty much the same, but without elements so in the view there would > be a check if the data-variable has any elements and the table would > only be shown when the data-array has any entries, otherwise there > would be only the message. > > What is the correct way to do this? Are there any other techniques to > deal with this kind of problem? > > Regards, > > DD --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
