Re: Helpers and Components

2006-10-20 Thread davide
leo.cacheux wrote:
> 
> You forgot to call "view" in the helper :
> 
> class MyHelper...
>function dumb(param1, param2){
>   return $this->view->controller->MyComponent->dumb(param1,
> param2);
>}

Cool, it works!

Now the question is: is this the better way to implement the feature?
Otherwise, what do you advise?

Thanks and Bye
Davide

-- 
By the power of Greyskull...



signature.asc
Description: OpenPGP digital signature


Re: Helpers and Components

2006-10-20 Thread leo.cacheux

You forgot to call "view" in the helper :

class MyHelper...
   function dumb(param1, param2){
  return $this->view->controller->MyComponent->dumb(param1,
param2);
   }
...


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



RE: Helpers and Components

2006-10-20 Thread Christian Winther

You could make your methods static and access them with ClassName::yourMethod 
aswell as $className->yourMethod

/Christian 

-Original Message-
From: cake-php@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of davide
Sent: 20. oktober 2006 11:49
To: Cake PHP ML
Subject: Helpers and Components

Sometime ago, I developed my own helpers for formatting date. Everything is ok, 
but now I need those function even in the controller level. So I thought about 
components. Everything is still fine. Now I wouldn't like to duplicate the 
code, I would like something like using the components code from the helpers. 
Something like

class MyHelper...
   function dumb(param1, param2){
  return $this->controller->MyComponent->dumb(param1, param2);
   }
...

It seems not to working, so I ask. Which should be the best way for obtaining 
this feature? Maybe a static library referenced with the vendors()?

Bye
Davide

--
By the power of Greyskull...



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~--~~~~--~~--~--~---



Helpers and Components

2006-10-20 Thread davide
Sometime ago, I developed my own helpers for formatting date. Everything
is ok, but now I need those function even in the controller level. So I
thought about components. Everything is still fine. Now I wouldn't like
to duplicate the code, I would like something like using the components
code from the helpers. Something like

class MyHelper...
   function dumb(param1, param2){
  return $this->controller->MyComponent->dumb(param1, param2);
   }
...

It seems not to working, so I ask. Which should be the best way for
obtaining this feature? Maybe a static library referenced with the
vendors()?

Bye
Davide

-- 
By the power of Greyskull...



signature.asc
Description: OpenPGP digital signature