I've looked into this a bit more and found that if i stick my custom
functions for AppController in:
/cake/libs/controller/app_controller.php
Then the function is visible in the sub controllers - is Cake 1.2 just
ignoring my /app/app_controller.php completely?! (also i tried putting
it in /app/controllers/app_controller.php and that didn't work
either...)
Thanks!
Seb
On Jan 30, 10:07 am, Seb <[EMAIL PROTECTED]> wrote:
> Hi!
>
> I'm just thinking about moving an App i'm working on to CakePHP 1.2 so
> that I can enjoy some of the new features... I seem to have fallen at
> the first hurdle though!
>
> In my existing app (for 1.1) I define some functions in my /app/
> app_controller.php for use elsewhere. E.g.:
>
> class AppController extends Controller {
> function isAdmin() {
> return isset($this->params['admin']);
> }
>
> }
>
> Then from my other controllers (which extend AppController), I can
> have things which call it:
>
> class SomeController extends AppController {
> function doSomething() {
> if ($this->isAdmin()) {
> // blah
> }
>
> }
>
> This works fine in 1.1, but causes a "Call to undefined method
> SomeController::isAdmin()" in CakePHP 1.2
>
> I can't really think of a better way to do things like that without
> duplicating lots of code (which I do my best to avoid at all times) so
> would like a way to make the Controllers inherit function properly
> from their parent objects...
>
> Please help!
>
> Thanks
>
> Seb
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---