Re: Component inside helper

2009-07-22 Thread Mark

i sometimes have to use a helper in a component
and otherwise
to avoid duplicating code (DRY principle)

i guess thats why you need to do that too (otherwise you shouldnt)
in this case, though, use App::import():

Helper:
function xyz() {
 App::import('Component', 'Some');
 $this->Some = new SomeComponent();
 $this->Some->domeSomething();
}



On 22 Jul., 10:10, Miles J  wrote:
> You dont
>
> Components are for controllers.
> Helpers are for views.
> Behaviors are for models.
>
> What exactly are you trying to do?
--~--~-~--~~~---~--~~
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: Component inside helper

2009-07-22 Thread Miles J

You dont

Components are for controllers.
Helpers are for views.
Behaviors are for models.

What exactly are you trying to do?
--~--~-~--~~~---~--~~
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: Component inside helper

2009-07-22 Thread Ragnis

Then, how can i use this helper inside controller?

On Jul 21, 10:07 pm, Miles J  wrote:
> You dont. Components are for controllers only.
>
> Build a helper to use in a helper.
>
> On Jul 21, 11:27 am, Ragnis  wrote:
>
>
>
> > How can i use my componnt inside helper?
--~--~-~--~~~---~--~~
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: Component inside helper

2009-07-21 Thread Miles J

You dont. Components are for controllers only.

Build a helper to use in a helper.

On Jul 21, 11:27 am, Ragnis  wrote:
> How can i use my componnt inside helper?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Component inside helper

2009-07-21 Thread Ragnis

How can i use my componnt inside helper?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---