Components are loaded with var $components = array("MyComponent"); and used
similar to models i.e. $this->MyComponent->function();

See http://manual.cakephp.org/chapter/components for more details.

Geoff

On 7/30/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> Thanks for you replies friends,
>
> i am new to cakephp can you tell me how can i load component in it.
> Also stil i have develop an component but i will try and create it and
> let u know. but pls tell me how can i load a compnent and how can i
> include it in the default.thtml.
>
> Thanks
>
> On Jul 30, 7:26 am, Tulio Faria <[EMAIL PROTECTED]> wrote:
> > Or you can try create a component, and load it with loadComponent or
> > anything else. I think it's better...
> >
> > On 29 jul, 21:54, Geoff Ford <[EMAIL PROTECTED]> wrote:
> >
> > > I believe $uses is overwritten by the actual controller that is
> > > invoked.  I suggest you use loadModel() and creat your own instances
> > > of the models you need.
> >
> > > Geoff
> > > --http://lemoncake.wordpress.com
> >
> > > On Jul 29, 8:27 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > > wrote:
> >
> > > > Hello Friends,
> >
> > > > I am new to Cakephp. I am having an problem in it. The scenario is
> :-
> >
> > > > i have categories and subcategories. i want to show them as menus so
> i
> > > > put them in the default.thtml file. To extract them from  the
> database
> > > > i have used  var $uses =array('Category',Subcategory) in
> > > > app_controller.php in app directory.
> >
> > > > and uses this coding :-
> >
> > > > function beforeFilter()
> > > >  {
> > > >          $maincatmenu=$this->Category->findAll();
> > > >                       //rest of the coding
> > > > On the basis of $maincatmenu i am extracting categories from the
> > > > subcategories etc.
> > > >  }
> >
> > > > It is working fine and menus are showing. But somehow when i try to
> > > > access some other controllers as categories views etc....
> >
> > > > It is showing the ERROR such as
> >
> > > > Notice: Undefined property: AppController::$Category in mypath\app
> > > > \app_controller.php on line 52
> >
> > > > Fatal error: Call to a member function findAll() on a non-object in
> > > > mypath\app\app_controller.php on line 52
> >
> > > > and for subcategory as well.
> >
> > > > I have tried to use var $uses in other controllers such as articles
> > > > (as i am storing articles on the basis of categories and
> > > > subcategories) as var $uses=array('Category','Subcategory');
> >
> > > > But still when i access the articles action such as mypath/articles/
> > > > view/2 etc.
> >
> > > > it is showing the same Error mentioned above.
> >
> > > > Pls help.
> >
> > > > Thanks
>
>
> >
>


-- 
http://lemoncake.wordpress.com

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