> I'm wondering what the best practice is for calling a method from
> inside one controller that happens to associate with another Model/
> Controller.
>
> For Instance, if I have a blog post that has many comments and I want
> to run a method within the CommentsController to format/clean the
> comment... how would I do this?
>
> I doubt something like this would work....
>
> PostController {
> ...
> function view($id){
> ..
> $this->Post->Comment->cleanComment();
> }
>
> Thoughts?

if it's something you'll want after getting any comments (or posts)
you could create a model method and then use afterfind to format the
data how you want, does wonders for cutting down on repetitive code.

check out the models section about callbacks in the manual

hth

jb



-- 


jon bennett
t: +44 (0) 1225 341 039 w: http://www.jben.net/
iChat (AIM): jbendotnet Skype: jon-bennett

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