I am dont know if this is the best way to accomplish this but you can
use the requestAction and renderElements to accomplish this.

Create a view - say cpanel/home

This will include elements - userelement, categoryelement,
itemselement

e.g.
<?= $this->renderElement('userelement'); ?>

Create each element in the elements folder ( and name it as
userelement.ctp) - this will probably be the same as your view.ctp for
each - except you will call requestAction('users/index')  and your
element can display the data object from controller however it wants.

The cpanel  view can decide where it wants the userelement to go..
you can have a table with sidebars etc. in your cpanel view

In your users controller - in index method - have some code to check
if its a requestAction  - as follows
if $blah = $this->User->findAll(.....  usual stuff)
//checks for requestAction
if(isset($this->params['requested'])) {
   return $blah;


Hope this helps

I did read some articles saying this was a slower way to do it. Does
anyone know if there is a better way to accomplish the same?

On Apr 24, 6:02 am, 浪漫様 <[EMAIL PROTECTED]> wrote:
> Dear mates,
> I was wondering how to display information from different tables on a
> same controller/view.
> For example... i want a control panel, that manages different sections
> of my website, and i want to show the last 5 entries in each table on
> the initial menu [ as a preview ].
> When the login is succeed at "www.mysite.com/cpanel/admins/login" goes
> to "www.mysite.com/cpanel/admins/index" and here i want to show the
> last 5 records of each table on my DB for maintenaice... "users",
> "categories", "items".... but i want them centralized at
> "www.mysite.com/cpanel/admins/index" instead of:
>
> "www.mysite.com/cpanel/users/index"
> "www.mysite.com/cpanel/categories/index"
> "www.mysite.com/cpanel/items/index"
>
> Also... how to limit CakePHP to take only 5 records [ "LIMIT (x,5)" on
> mysql ] ?
> Thank you very much!
> Best Regards,
>
> Rohman


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to