@fahad
you should point out that you would need to create the object prior to
using it
for all those who are not so familiar with that

App::import('Helper', 'Html');
$this->Common = new CommonHelper();
$foo = $this->Common->do();

sometimes this is not neccessary
if the helper function does something on its own (without refering to
other class vars or functions)
you can access them statically

$foo = CommonHelper::foo();


On 7 Sep., 21:35, Fahad <faha...@gmail.com> wrote:
> I wouldn't suggest you use a helper in your controller. but you can do
> it by importing your desired library.
>
> in your controller:
> App::import('Helper', 'Html');
>
> On Sep 7, 5:14 pm, cogitovn <cogit...@gmail.com> wrote:
>
> > Hi all,
> > I'm a newbie in cakePHP.
> > As I know, helper is a part of View. So, how to use a helper in Controller
> > or Model?
> > For example, I want to Html helper, Xml Helper in a controller, in order to
> > call some methods such as, html->url(), xml->serialize()....
> > Please help me on detail.
> > Thank you!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to