You can paste some code into bootstrap.php, which then makes your function available everywhere. You should never include business/ controller logic into a view; that's just bad practice.
Well, putting code in the bootstrap.php file is also not very MVC- pattern compliant, but sometimes you gotta do whatcha gotta do. -J. On Mar 26, 5:20 pm, CodeHooligans <[EMAIL PROTECTED]> wrote: > Hello all, > > I'm having a but of an issue. I have two forms. But are simple and > submit to discrete backend controllers. Both have their own set of > views (add, edit, index). Each submit into respective tables in the > database. I'm running cake 1.1.xxx (The current stable release). > > So here is my issue. I'm try to just include a common function that is > used in each of the index.thtml files. I've tried a traditional PHP > include. Placed the php file under the site root and tried including > the path and filename. Something I would do under a normal PHP > environment. > > The included file will load without issues. Meaning if I use require() > no error is reported. The problem is the function that is inside the > included file is not loaded. > > I've read through the other message and have tried the app/vendors and > calling the include file via vendor('filename'); without much luck. > > What am I missing here? The function runs fine when I place it > directly into the index.thtml files(s). My problem is I really don't > want to have this in 2 different places. It's the same code. Also I > would put this in the controller but again it would need to be in both > controllers. Does not seem efficient to me. > > P- --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---