Re: Use Controller in Helper

2009-03-11 Thread mscdex

On Mar 10, 9:09 pm, wolf net netwolf...@gmail.com wrote:
 Controller: $this-set('controller', $this);
 view: $controller-action();

IMHO that's a bad idea on many levels.

What I meant was something like: $this-set('testResults', $this-
CustomComponent-getTest());
Then in the view you use $testResults.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Use Controller in Helper

2009-03-10 Thread bäckerlehrling

Hello Backers,

Im Stuck with this, how would you implement this:

I made a CustomController wich method test() calls CustomComponent-
getTest()
I made a CustomComponent wich methods are setTest() getTest().
I made a CustomHelper wich method is getTest() wich should call the
CustomComponent-getTest()

Now how can i acces the CustomController in the CustomHelper to call
the CustomController's CustomComponent Method getTest()? How would you
do this?

There is no controller available in the Helper! Did they forget to
implement this or is this against the concept?

Thanks for any help!

Greetings

--~--~-~--~~~---~--~~
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: Use Controller in Helper

2009-03-10 Thread Miles J

Thats completely against the concept, why on earth are you doing it
that way? Helpers are used for view support, Components are used for
controller support.
--~--~-~--~~~---~--~~
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: Use Controller in Helper

2009-03-10 Thread mscdex

On Mar 10, 12:29 pm, bäckerlehrling c.fue...@gmail.com wrote:
 Now how can i acces the CustomController in the CustomHelper to call
 the CustomController's CustomComponent Method getTest()? How would you
 do this?

I would do a call to $this-set() in your controller to set a variable
to be used in the view which contains the results of getTest().
--~--~-~--~~~---~--~~
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: Use Controller in Helper

2009-03-10 Thread wolf net
Controller: $this-set('controller', $this);
view: $controller-action();

2009/3/11 mscdex msc...@gmail.com


 On Mar 10, 12:29 pm, bäckerlehrling c.fue...@gmail.com wrote:
  Now how can i acces the CustomController in the CustomHelper to call
  the CustomController's CustomComponent Method getTest()? How would you
  do this?

 I would do a call to $this-set() in your controller to set a variable
 to be used in the view which contains the results of getTest().
 


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