I tried changing the method to be public but the problems still
persist. Any other suggestions? I'm really stumped on this!

On Feb 9, 1:51 pm, brian <[email protected]> wrote:
> Well, you're closer to a solution, at least. AFAIK, you shouldn't need
> to do anything special with the component after loading with
> App::import(). But, the component is obviously missing a handle to the
> controller. So, the problem might be a combination of the fact that
> you're doing this in AppController and that the method is
> private/protected. You could try making it a public method. That last
> bit is not much better than a wild guess, though.
>
> On Mon, Feb 9, 2009 at 1:27 PM, Kyle Decot <[email protected]> wrote:
>
> > Well if I remove the App::import(... and load the Email Component via
> > the components var, then everything goes smoothly. I would like to
> > avoid this however since this function is used across a large number
> > of controllers but I'd really like to load it only when needed, as my
> > app is already beginning to run slow. Any ideas?
>
> > On Feb 9, 11:43 am, brian <[email protected]> wrote:
> >> Well, I'm certainly no expert, so you might well benefit from someone
> >> else jumping in here. ;-)
>
> >> Try removing these lines:
>
> >>        App::import("Component","Email");
> >>        $this->Email = new EmailComponent();
>
> >> ... as well as the inititlaize line I suggested. Then, add this line
> >> to the top of AppController:
>
> >> public $components = array('Email');
>
> >> (replace public with var if you're stuck with PHP4.x)
>
> >> See if that works. I have a feeling the problem stems from the fact
> >> that you're importing a component into AppController, rather than
> >> loading it in the normal fashion. If you don't send email from many
> >> controllers, this may not be the most efficient way, but you'll at
> >> least be a bit closer to figuring out why it's failing for you.
>
> >> The crux of it is that the component isn't getting a handle to the
> >> controller for some reason.
>
> >> On Mon, Feb 9, 2009 at 2:29 AM, Kyle Decot <[email protected]> wrote:
>
> >> > When trying to use the initialize method, I get a undefined method
> >> > error:
>
> >> > Fatal error: Call to undefined method EmailComponent::initialize() in /
> >> > home/affinit3/public_html/theskateparkdirectory/app/app_controller.php
> >> > on line 60
>
> >> > Any ideas?
>
> >> > On Feb 9, 2:22 am, brian <[email protected]> wrote:
> >> >> change the method name to _sendEmailNotification (single underscore)
> >> >> to make it protected, rather than private
>
> >> >> $this->Email = new EmailComponent();
> >> >> $this->Email->initialize($this);
>
> >> >> Those are the only things that I can think of. I've never imported a
> >> >> component inside of an AppController method - private, protected, or
> >> >> public. Maybe that's the problem?
>
> >> >> On Mon, Feb 9, 2009 at 1:57 AM, Kyle Decot <[email protected]> wrote:
>
> >> >> > Ah, stupid mistake but I've updated the set to be body instead of
> >> >> > email_body and am still getting the same results. Any other ideas?
>
> >> >> > On Feb 9, 1:55 am, brian <[email protected]> wrote:
> >> >> >> sorry, I should have unquoted that. This should be clearer.
>
> >> >> >> $this->set("email_body",$body);
>
> >> >> >> Notice (8): Undefined variable: body [APP/views/elements/email/html/
> >> >> >> email_notification.ctp, line 1]
--~--~---------~--~----~------------~-------~--~----~
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