If calling from beforeSave(), the best place might be AppModel. If you don't already have one of those, copy the file at cake/libs/models/app_model.php to your app directory (not app/models) and modify that. You would then call the function from within your own model as $this->yourFunction(...).
Other places to put this function would be bootstrap.php or AppController. If in the former, call it as yourFunction(). If the latter, call it from within a controller as $this->yourFunction(...). On Tue, Sep 22, 2009 at 4:45 PM, kdubya <kenwin...@winanstech.com> wrote: > > I'm trying to follow the structure of CakePHP but I don't know where > to put a utility function that I would like to call to filter certain > fields in more than one Model. > > The utility function filters most HTML tags, but allows some safe ones > like <b> etc. and replaces newlines with <br>. > > I want to call this utility function in the beforeSave() in more than > one Model. So where is the proper place to put it? It's not a behavior > (I don't think). > > Thanks, > Ken > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---