Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
TextHelper Problem
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Lukar Dennig  
View profile  
 More options Oct 12 2009, 9:52 am
From: Lukar Dennig <lukarden...@gmail.com>
Date: Mon, 12 Oct 2009 06:52:26 -0700 (PDT)
Local: Mon, Oct 12 2009 9:52 am
Subject: TextHelper Problem
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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
brian  
View profile  
 More options Oct 12 2009, 1:22 pm
From: brian <bally.z...@gmail.com>
Date: Mon, 12 Oct 2009 13:22:10 -0400
Local: Mon, Oct 12 2009 1:22 pm
Subject: Re: TextHelper Problem
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.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lukar Dennig  
View profile  
 More options Oct 12 2009, 2:50 pm
From: Lukar Dennig <lukarden...@gmail.com>
Date: Mon, 12 Oct 2009 11:50:46 -0700 (PDT)
Local: Mon, Oct 12 2009 2:50 pm
Subject: Re: TextHelper Problem
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 <bally.z...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
euromark (munich)  
View profile  
 More options Oct 12 2009, 3:24 pm
From: "euromark (munich)" <dereurom...@googlemail.com>
Date: Mon, 12 Oct 2009 12:24:25 -0700 (PDT)
Local: Mon, Oct 12 2009 3:24 pm
Subject: Re: TextHelper Problem
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 <lukarden...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lukar Dennig  
View profile  
 More options Oct 12 2009, 3:53 pm
From: Lukar Dennig <lukarden...@gmail.com>
Date: Mon, 12 Oct 2009 12:53:28 -0700 (PDT)
Local: Mon, Oct 12 2009 3:53 pm
Subject: Re: TextHelper Problem
Yay! Thanks a lot.

On Oct 12, 9:24 pm, "euromark (munich)" <dereurom...@googlemail.com>
wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
brian  
View profile  
 More options Oct 12 2009, 3:54 pm
From: brian <bally.z...@gmail.com>
Date: Mon, 12 Oct 2009 15:54:41 -0400
Local: Mon, Oct 12 2009 3:54 pm
Subject: Re: TextHelper Problem
On Mon, Oct 12, 2009 at 3:24 PM, euromark (munich)

<dereurom...@googlemail.com> wrote:

> 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

My bad. I did assume that a Helper listed in the $helpers array could
be used in the controller without also importing() it. I don't know
that I'd ever tried that.

I think it makes more sense to put this code in the view, fwiw.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »