Re: calling helper functions from within the controller

2008-07-11 Thread Daniel Hofstetter

Hi Siegfried,

>  the subject says it all:
> is it possible to call a helper function from within the controller.
> Of course the helper is
> included in the var $helpers = array('Myhelper');
>
> class MyController extends AppController {
>    function index() {
>         $this->Myhelper->function_to_call(); // DOES NOT WORK - is it
> possible in any way ?
>    }
>
> }

Just an idea:

function index() {
$myHelper = new MyHelper();
$myHelper->function_to_call();
$this->set('myHelper', $myHelper);
}

--
Daniel Hofstetter
http://cakebaker.42dh.com
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: calling helper functions from within the controller

2008-07-11 Thread francky06l

Maybe parameters that do not change often can be in a config
file  .. ? Then use Configure::read where ever you are ...
just a hint

On Jul 11, 9:56 pm, "Siegfried Hirsch" <[EMAIL PROTECTED]>
wrote:
> Hello Chris,
>
> yes I know. Maybe I need a hint for my problem.
>
> I have written a new Helper. Now I want to set some variables, that
> I can use from within the helper (yes I know I could handle this with
> parameters), but I am trying to save some parameters, cause the
> values are always the same.
>
> Siegfried
>
> On Fri, Jul 11, 2008 at 9:41 PM, Chris Hartjes <[EMAIL PROTECTED]> wrote:
>
> > Helpers are called within views, not controllers.
>
> > Perhaps you can place that function somewhere else?  Like in a model?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: calling helper functions from within the controller

2008-07-11 Thread Siegfried Hirsch

Hello Chris,

yes I know. Maybe I need a hint for my problem.

I have written a new Helper. Now I want to set some variables, that
I can use from within the helper (yes I know I could handle this with
parameters), but I am trying to save some parameters, cause the
values are always the same.

Siegfried

On Fri, Jul 11, 2008 at 9:41 PM, Chris Hartjes <[EMAIL PROTECTED]> wrote:
>
> Helpers are called within views, not controllers.
>
> Perhaps you can place that function somewhere else?  Like in a model?

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: calling helper functions from within the controller

2008-07-11 Thread Chris Hartjes

On Fri, Jul 11, 2008 at 3:39 PM, Siegfried Hirsch
<[EMAIL PROTECTED]> wrote:
>
> Hello,
>
>  the subject says it all:
> is it possible to call a helper function from within the controller.
> Of course the helper is
> included in the var $helpers = array('Myhelper');

Helpers are called within views, not controllers.

Perhaps you can place that function somewhere else?  Like in a model?

-- 
Chris Hartjes
Motto for 2008: "Moving from herding elephants to handling snakes..."
@TheKeyBoard: http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



calling helper functions from within the controller

2008-07-11 Thread Siegfried Hirsch

Hello,

 the subject says it all:
is it possible to call a helper function from within the controller.
Of course the helper is
included in the var $helpers = array('Myhelper');

class MyController extends AppController {
   function index() {
$this->Myhelper->function_to_call(); // DOES NOT WORK - is it
possible in any way ?
   }
}

Siegfried

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---