How to build a “dashboard” for your application in CakePHP

As an addition to my recent post, I wanted to share a technique, which should allow you to pretty easily build a “dashboard” for your app. The dashboard would basically grab some information from a few different models and display it all on one page. First, let’s go over some assumptions… We are not going to use requestAction(), because it’s the “worst” (and absolutely the last-resort approach). It has it’s purposes, but we want to avoid it as much as possible. (I’m not going into detail as to why, because that has been covered many times in many many places, so you can just fire-up your trusty search engine to learn more). The models from which we’ll gather the information are absolutely not related to one another, if they are related… this is not the best approach. Remember, we don’t want to reload any models (objects), which CakePHP has already loaded for us. So, keeping both of those things in mind, here’s what we’ve got: Post model, with a method getTop(); News model, with a method getRecent(); Employee model, with a method getTopPerformers(); Product model, with a method getTopSellers(); (You are welcome to come up with your own methods …

How to build a "dashboard" for your application in CakePHP

m4s0n501 As an addition to my recent post, I wanted to share a technique, which should allow you to pretty easily build a “dashboard” for your app. The dashboard would basically grab some information from a few different models and display it all on one page. First, let’s go over some assumptions… We are not going to use requestAction(), because it’s the “worst” (and absolutely the last-resort approach). It has it’s purposes, but we want to avoid it as much as possible. (I’m not going into detail as to why, because that has been covered many times in many many places, so you can just fire-up your trusty search engine to learn more). The models from which we’ll gather the information are absolutely not related to one another, if they are related… this is not the best approach. Remember, we don’t want to reload any models (objects), which CakePHP has already loaded for us. So, keeping both of those things in mind, here’s what we’ve got: Post model, with a method getTop(); News model, with a method getRecent(); Employee model, with a method getTopPerformers(); Product model, with a method getTopSellers(); (You are welcome to come up with your …