How do i use the view->render member?

Or, more likely, do i even need to?

I'm trying to, from my default.ctp, load a few different cake views for menu stuff etc.

Pretty much, they make db calls to find the most recently added entries and display them.

This works fine - i'm currently using jquery to load these elements, but it just takes a bit of time to get it all loaded and set to the page. I'm hoping i can get cakephp itself to do this loading.

I've read about the requestAction method, but I don't really want to be re-writing the menu components in the default.ctp (which is my understanding of how the requestAction works - gets the data without the layout).

I've also read about view->render, but i can't work out how to really use it. Every time i try, it seems to end up calling the default.ctp again - oh, here's what i'm doing (from within default.ctp)


$this->render('/DifferentModel/Method/parameter_to_use',null);

Here, i'm (trying to be) calling the 'different model' and the method (because i'm in the default.ctp, it's not like i'm really using any *one* model), and passing the parameter in one call, and then telling it (well, trying to tell it) not to use a layout, and just paste into the page.

Instead, my page just loads the default.ctp twice and then explodes because of all the calls to link() that happen in the head.

I'm assuming i'm doing something wrong - or there's a better way to do it?

andrew!

Asked by aiyer, on 8/3/10

1 Answer

you should use elements for that

http://book.cakephp.org/view/97/Elements

and look at something like

http://teknoid.wordpress.com/2008/12/16/how-to-build-a-dashboard-for-your-application-in-cakephp/

Answered by dogmatic69on 8/3/10

<< previous next >>

Your Answer

You can use Creole Wiki Syntax to format your text.

Tagged with

Rating

0

Viewed

290 times

Last Activity

on 8/3/10