Just to be clear, I created a file named app_controller.php and put it
in my app folder, so it's at the same level as my model, view, and
controller folders.

The first thing I tried was using a class inside app_controller.php.  I
soon realized I had no idea what it should be called.  I tried
AppController extends AppController, then I thought, that doesn't seem
right, so I renamed it to LoginController extends AppController.

Cake was unhappy:  Fatal error: Class logincontroller: Cannot inherit
from undefined class appcontroller in
/Library/WebServer/vhosts/calzone/app_controller.php on line 2

I then tried changing it AppController extends Controller (just like it
is in the cake folder).

On the one hand, I had no errors with this, but there was no way I was
getting my beforeFilter functions to work properly. I tried splitting
out the functions to a user model and using a redirect, but that caused
a bad loop.  I also tried using render() and requestAction() to no
avail.

So it hit me that maybe this file wasn't supposed to contain a class,
but just loose code.  So I extracted it from the code thinking "cool,
now this will just be included at the top of every controller."  And
then I went back to getting errors.

Obviously, I'm going about this the wrong way.

While we're at it:

1) how exactly do I determine if the "current page" is xxxx so I could
exclude the global code.
and 2) Ideally, I would not be using a redirect, but simply replacing
the contents of what you would normally see at the same url with a
login page; but that's way more advanced in cake than I can even dream
at this point :)


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

Reply via email to