Hi,

Thanks Geoff, I tried this and removed this line:

        var $uses = array("User");

in PagesController, but this time I got a error in index.php:

Missing Model

No class found for the Page model
.........
Create the class below in file : app/models/page.php

What confused me is, PageController and my app's controller are in the 
same folder, and are all extend from AppControler, looks like they have 
no difference. But why they have the different behavior?


Geoff Ford wrote:
> If you add $uses = array("User");  to the appcontroller it will be
> available to all controllers including the pages controller.
> 
> Geoff
> --
> http://lemoncake.wordpress.com
> 
> On Aug 8, 11:04 am, "Tang Jianyu(??????)" <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> Maybe this is a silly question, but I didn't find answer elsewhere,
>> please give me some advice, thanks.
>>
>> I need to display the currently login user's profile in my app's most
>> pages, including the home page:
>>
>>        http://localhost/myapp/index.php/
>>
>> So, I put the user's email into session after login, and load it's
>> profile before rendering in every page. I wrote a method which was put
>> in AppController, like:
>>
>>         function beforeRender() {
>>                 $this->set_user_in_session();
>>         }
>>
>> Like this, I did can get properly output in all other pages, only except
>> the
>> "index.php/", the error message is:
>>
>> Fatal error: Class 'User' not found in
>> /home/jianyu/workspace/myapp/app_controller.php on line 61
>>
>> At last, I found a way to add a var
>>
>>         $uses = array("User");
>>
>> to PagesController.
>>
>> My question is, is this the best solution? Why and where the
>> PagesController are different treated with other controller?
>>
>> Thanks again.
>>
>> Regards,
>>
>> Jianyu
> 


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