I'll second that. It really seems that Cake could take care of this for you.

Create a view with:

<?= $this->element('your_controller/some_method', array('cache'=>'1 day')) ?>

Put all of your other params in the array as well and they'll be
available in the view, from where you can pass them through a
requestAction() to your controller.

In the controller:

function afterSave()
{
        clearCache('element_cache_your_controller_some_method', 'views', '');
}

Or put the clearCache() wherever it makes the most sense for your situation.

b

On Mon, Mar 31, 2008 at 5:49 PM, Baz <[EMAIL PROTECTED]> wrote:
> Not sure this will help, but here goes:
>
> What my Cake experience has shown me is that, there was a lot of stuff that
> I used to do "manually" that is now made obsolete by CakePHP. I've wasted a
> lot of trying to to port legacy code into my Cake projects, that I later
> realized that I didn't need.
>
> Off the top of my head, CakePHP has some caching features. These may make
> your database HTML snippet caching more trouble than it's worth. You could
> cache your "snippet" as an element and include it like that, and you could
> simply clearCache() for that elemet "when your parameters change".
>
> Hope this helps....
>
>
>
> On Mon, Mar 31, 2008 at 4:06 PM, Matt <[EMAIL PROTECTED]> wrote:
> >
> > Hi all,
> >
> > My application accepts a fairly large collection of parameters and
> > uses them to generate an HTML snippet. The snippet is generated
> > lazily, so that the parameters can change frequently but the HTML is
> > only generated when it's needed. Once generated, the HTML is cached
> > (in the database) until the parameters change again.
> >
> > I'm new to MVC, and not sure where the best place to put the HTML
> > generation code is. I would guess that the Model is the best logical
> > place for it, since it will be updating a model reference with the
> > generated HTML. What makes me wonder though, is that the generation
> > code actually references other models (because the parameters can be
> > logically separated).
> >
> > Would the Controller be a better place for this code, or should I
> > leave it in the Model? If so, how do you access other models from
> > within a Model class?
> >
> > Many thanks,
> > Matt.
> >
> >
> >
> >
> >
> >
>
>
>  >
>

--~--~---------~--~----~------------~-------~--~----~
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