well the helper IS NOT available in the controller right away

you need to add

App::import(Helper,Text);
$this->Text = new TextHelper();

now you can work with it... brian probably didnt read your post and
thought you talked about a component



On 12 Okt., 20:50, Lukar Dennig <[email protected]> wrote:
> Thanks. However if i use $this->Text->autoLinkUrls() i get: "Undefined
> property: NewsController::$Text"...
> its just as if the helper is completely ignored.
>
> On Oct 12, 7:22 pm, brian <[email protected]> wrote:
>
> > Use $this->Text->whatever() while in the controller and
> > $text->whatever() in the view.
>
> > But note that autoLinkUrls() returns the string. You'll need to modify
> > the value in $this->data. Either that, or use the method in your view.
>
> > On Mon, Oct 12, 2009 at 9:52 AM, Lukar Dennig <[email protected]> wrote:
>
> > > Hi everyone,
>
> > > im having a problem with the TextHelper and i totally dont get why...
>
> > > in a nutshell my controller (based on the Blog Tutorial) looks like
> > > this:
>
> > > class NewsController extends AppController {
>
> > >        var $name = 'News';
> > >        var $helpers = array('Text');
>
> > >        function edit($id = null) {
> > >                $this->News->id = $id;
> > >                if (empty($this->data)) {
> > >                        $this->data = $this->News->read();
> > >                } else {
> > >                        $text->autoLinkUrls("asd"); // (line 64)
> > >                        [...]
> > >                }
> > >        }
> > > }
>
> > > Now when i call the function (save the form) i get:
> > > "Notice (8): Undefined variable: text [APP\controllers
> > > \news_controller.php, line 64]"
>
> > > Without the line everything works. Ive been searching the cookbook for
> > > an hour but i cant come up with any reason. My AppController is empty
> > > btw. I also tried "$this->helpers[] = 'Time';" in the function but it
> > > didnt help.
>
> > > Any help would be appreciated...
>
> > > Lukar
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to