This is the article you want to read:

http://bakery.cakephp.org/articles/view/creating-reusable-elements-with-requestaction

For a home page, you maybe won't even have a controller.  Instead you
create a template in your pages directory.

This page will include a number of calls to
$this->element('latest_news', array('cache' => '+1 hour') );
$this->element('popular_stories'', array('cache' => '+4 hours') );
$this->element('picture_of_the_day', array('cache' => '+1 day') );
$this->element('quote_of_week', array('cache' => '+1 week') );

Each element will then have a call to requestAction().

Note how the controller called by requestAction() checks for $this-
>params['requested'], and returns a datarray.

HOWEVER, you absolutely must take advantage of caching on this.
requestAction is expensive, so you want to call it as few times as
possible.

Also, if you want to change the content before the cache expiration
happens, you will have to manually replace the cached file.

I am doing this currently on a live website, and am quite happy with
the performance.

-Aran

On May 21, 6:54 am, "Sliv (Tim MacAleese)" <[EMAIL PROTECTED]> wrote:
> As for posting convention, well, google doesn't care which message you
> reply to in a thread and will put your post at the end of the thread
> as far as it displays in the web view (not sure about the email view).
>
> As for $this->renderElement, just want to point out that this has just
> been deprecated in the latest rev of 1.2 ( I think within the past few
> days); now it's just $this->element and   passed parameters.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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