CakePHP:通过从其他控制器获取数据来创建仪表板页面

I have researched for this solution all month but I didn't get the right answer for my page. Please take a look and give me suggestions.

I have the admin page and the view is Dashboard.

I have tables are Staffs, Customers, Comments, Contacts....

I created these page to show data on view successfully for each of them.

NOW, I want to make the dashboard page to view each 5 top new Staffs, Customers, Comments....were being added to system. The summary page. My Dashboard page will be my main page (when access the domain, it will direct to dashboard page).

My question are:

  1. Where should I create the Dashboard page in?

  2. How can I take the data from Staff Controllers, Customers Controller....in the dashboard page. Dashboard page is not include in view of these above controllers.

I use cakephp 1.3

Please give me the best suggestion for this. Thank everyone much !

First of all it depends upon the way you wanna go ahead:

1) Where should I create the Dashboard page in?

Its totally upto you where you want to create the page, but it should ideally be the page to be redirected after the admin login.(BTW its a foolish question to be asked.)

2) How can I take the data from Staff Controllers, Customers Controller....in the dashboard page. Dashboard page is not include in view of these above controllers.

You can do that in 2 ways:

a) Create common functions for these in their respective model and just call those into your single function created for dashboard.

b) Create functions in their respective controller and import the controller and use these methods in the dashboard function(But avoid this approach as long as you can as it will load unnecessary controller class files).

Hope it helps you.