Re: how to deal with empty data in index-views (example inside...)
Hey Martin, interesting idea, really! I thought of such a solution for maybe new messages that a user has or like you pointed out, files etc. I think I should take some time to think about my database structure, there may be a few things I could improve and make things a little smoother and better. For now I check whether a data-containing variable is empty or not, and then I display the belonging part of the view. I guess that's quite ok, but to be honest, I'm not a big fan of much logic in views... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: how to deal with empty data in index-views (example inside...)
I just check for empty data and switch out part of the view. Much like the code sample Ceryl supplied. For more advanced use you can go all the way to using a status field in your database. An example, still from my file manager, User hbtm File can be used to figure out if a user has seen a file before or if it is new. Each time a file is displayed to a user an association is created indicating the file has been seen by this user. Each load of a list of files does a check and formats data for the view so it can know which files to indicate as new. The trick here is to do this kind of thing without slowing your application down to a crawl. I had to do a lot of trickery to be able to handle a few thousand files in a folder without slowing down or even running out of memory (using recursive = out of memory). For your situation you might use a field (fields) in the User model to determine if it is the first time a user has activated a feature. Most of the time the smart thing is to write the copy cleverly so it works for both first-time and I just erased everything situations. On Oct 12, 6:28 pm, DigitalDude e.blumsten...@googlemail.com wrote: @Ceryl: yeah I did a little test-view and I think you're right, when you have a lot of different pages where empty data can occur, there would be many elements. So I tried to check the data within the view and displayed a certain div-container when the data-array was empty. It works without any problems. @Martin: This is exactly what I meant. First run information should be given to the user, after the user registers and sees a function or category for the first time. How did you implement that? Do you check if the data is empty within the view? What other ways could we go to achieve the desired behaviour? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: how to deal with empty data in index-views (example inside...)
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 e.blumsten...@googlemail.com 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 cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: how to deal with empty data in index-views (example inside...)
@Ceryl: yeah I did a little test-view and I think you're right, when you have a lot of different pages where empty data can occur, there would be many elements. So I tried to check the data within the view and displayed a certain div-container when the data-array was empty. It works without any problems. @Martin: This is exactly what I meant. First run information should be given to the user, after the user registers and sees a function or category for the first time. How did you implement that? Do you check if the data is empty within the view? What other ways could we go to achieve the desired behaviour? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
how to deal with empty data in index-views (example inside...)
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 cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: how to deal with empty data in index-views (example inside...)
I always do the following in the view. ($data is passed from the controller) h1 Some Title /H1 ?php if (empty($data)) { echo No entries/posts/products/etc. found } else { // Create the table here, list the posts/products/entries/etc, whatever... } ? . I doubt there are better ways... The elements one you proposed looks a bit cleaner in the sourcecode I guess, but when you split up your views over all kind of elements, it'll get unmanageble in my opinion and harder to make quick changes... On 11 okt, 20:04, DigitalDude e.blumsten...@googlemail.com 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 cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---