Well I did not see the startup function in the bin, besides the code
is still a Controller and not a component.
Maybe you should start by an "empty" component, that you test with a
"test" controller ..

the component should look  like this (almost empty) :

class CalendartComponent extends Object
{
    var $controller = true;
    var $calendarModel = null;

      function startup(&$controller)
      {
             $this->controller =& $controller;
             loadModel('Calendar');
            $this->calendarModel =& new Calendar();
      }
.
}

After you have to convert the rest of the code into the component.
Maybe better to use a Test controller that will include tour Calendar
Component

Good luck
On Jul 18, 6:54 pm, citBolon <[EMAIL PROTECTED]> wrote:
> Thanks for your help, it's very useful.. I have the code 
> inhttp://bin.cakephp.org/view/1454174569, the cuestion is: I need to
> declare the method startup? cause this method cause error: Warning:
> pg_query() [function.pg-query]: Query failed: ERROR: syntax error at
> or near "startup" at character 1 in /Applications/MAMP/htdocs/
> sn_bra_13_07_07/cake/libs/model/dbo/dbo_postgres.php on line 114
>
> Query: startup
>
> On 17 jul, 15:53, francky06l <[EMAIL PROTECTED]> wrote:
>
> > You will access the component method by using $this->Compomentname-
>
> > >method() into the controller.
>
> > You can use the controller object in the startup function and use
> > something like $this->controller->set() in your component methods  to
> > pass variable to views, Thus they can be used by the helper.
>
> > For the DB, you could use a model and use 1) loadmodel()  2)  this->model = 
> > & new model() in your component::startup. Then you can access
>
> > all methods of model and the DB into the component (ie : $this->model-
>
> > >findAll() ... etc .. )
>
> > A good example for this (no model though) is the pagination component
> > and helper for cake 1.1
>
> > On Jul 17, 7:37 pm, citBolon <[EMAIL PROTECTED]> wrote:
>
> > > I'm trying to create a calendar component, i have a
> > > calendars_controller.php it works well but I want it to make re-usable
> > > for layouts. How can i do this ?
>
> > > how can i use the controller methods in a component ?
>
> > > summary: i want to convert a controller and view to a component and
> > > helper
> > > note: the calendar makes query to db.


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