Re: Using Configure class in custom AppError

2009-02-09 Thread Dr. Loboto

It depends on what do you do in beforeFilter (and there is NO callback
named "beforeAction")

On Feb 9, 8:44 pm, oleonav  wrote:
> Hi Loboto, that thought came across my mind already. So I will
> refraise my question;
>
> How do I run functions etc. found in the beforeAction of the
> AppController or at least run actions needed to initialize the
> Configure class without duplicating all code from the AppController ->
> beforeAction to my AppError class..
>
> Any guesses?
>
> Thanks
>
> On Feb 7, 1:06 pm, "Dr. Loboto"  wrote:
>
> > AppController::beforeFilter() isn't called if no controller found to
> > serve request. So yours Configure just do not contain values you need
> > on "Missing Controller" errors as they wasn't set.
>
> > On Feb 6, 8:54 pm, oleonav  wrote:
>
> > > Hi there,
>
> > > I have some variables set using the Configure class in the
> > > beforeFunction of the main AppController. I use for multiple things,
> > > for example to set the title of the page.
>
> > > I need a custom 404 error page, so I made a custom AppError class
> > > containing the function error404, which overrides the build function
> > > from the framework (see below).
>
> > > The problem is that the Configure class is not working at all in
> > > AppError.
>
> > > Any suggestions?
>
> > > regards,
>
> > > class sample --
> > > class AppError extends ErrorHandler
> > > {
> > >         function error404()
> > >         {
> > >                 //read the config file
> > >                 $config = Configure::read('siteConfig');
>
> > >                 //set it so it's available in layout & views
> > >                 $this->set('config', $config);
>
> > >                 ...
> > >                 ... run other code 
> > >                 .
>
> > >                 //run parent class function
> > >                 parent::__construct();
> > >         }
>
> > > }
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using Configure class in custom AppError

2009-02-09 Thread oleonav

Hi Loboto, that thought came across my mind already. So I will
refraise my question;

How do I run functions etc. found in the beforeAction of the
AppController or at least run actions needed to initialize the
Configure class without duplicating all code from the AppController ->
beforeAction to my AppError class..

Any guesses?

Thanks

On Feb 7, 1:06 pm, "Dr. Loboto"  wrote:
> AppController::beforeFilter() isn't called if no controller found to
> serve request. So yours Configure just do not contain values you need
> on "Missing Controller" errors as they wasn't set.
>
> On Feb 6, 8:54 pm, oleonav  wrote:
>
> > Hi there,
>
> > I have some variables set using the Configure class in the
> > beforeFunction of the main AppController. I use for multiple things,
> > for example to set the title of the page.
>
> > I need a custom 404 error page, so I made a custom AppError class
> > containing the function error404, which overrides the build function
> > from the framework (see below).
>
> > The problem is that the Configure class is not working at all in
> > AppError.
>
> > Any suggestions?
>
> > regards,
>
> > class sample --
> > class AppError extends ErrorHandler
> > {
> >         function error404()
> >         {
> >                 //read the config file
> >                 $config = Configure::read('siteConfig');
>
> >                 //set it so it's available in layout & views
> >                 $this->set('config', $config);
>
> >                 ...
> >                 ... run other code 
> >                 .
>
> >                 //run parent class function
> >                 parent::__construct();
> >         }
>
> > }
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Using Configure class in custom AppError

2009-02-07 Thread Dr. Loboto

AppController::beforeFilter() isn't called if no controller found to
serve request. So yours Configure just do not contain values you need
on "Missing Controller" errors as they wasn't set.

On Feb 6, 8:54 pm, oleonav  wrote:
> Hi there,
>
> I have some variables set using the Configure class in the
> beforeFunction of the main AppController. I use for multiple things,
> for example to set the title of the page.
>
> I need a custom 404 error page, so I made a custom AppError class
> containing the function error404, which overrides the build function
> from the framework (see below).
>
> The problem is that the Configure class is not working at all in
> AppError.
>
> Any suggestions?
>
> regards,
>
> class sample --
> class AppError extends ErrorHandler
> {
>         function error404()
>         {
>                 //read the config file
>                 $config = Configure::read('siteConfig');
>
>                 //set it so it's available in layout & views
>                 $this->set('config', $config);
>
>                 ...
>                 ... run other code 
>                 .
>
>                 //run parent class function
>                 parent::__construct();
>         }
>
> }
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Using Configure class in custom AppError

2009-02-06 Thread oleonav

Hi there,

I have some variables set using the Configure class in the
beforeFunction of the main AppController. I use for multiple things,
for example to set the title of the page.

I need a custom 404 error page, so I made a custom AppError class
containing the function error404, which overrides the build function
from the framework (see below).

The problem is that the Configure class is not working at all in
AppError.


Any suggestions?

regards,


class sample --
class AppError extends ErrorHandler
{
function error404()
{
//read the config file
$config = Configure::read('siteConfig');

//set it so it's available in layout & views
$this->set('config', $config);

...
... run other code 
.


//run parent class function
parent::__construct();
}
}

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---