you know.. I experience the same issue....
I have an internal email controller in my application, and I can't seem to link properly because of this issue. It's an issue because my application (for development) is not off the / root.
I just recently learned about elements and using $this->render() from the controller.... I saw in someone else's code that they did this.
function _getBodyText($view) {
// Temporarily store vital variables used by the controller.
$tmpLayout = $this->controller->layout;
$tmpAction = $this->controller->action;
$tmpOutput = $this->controller->output;
$tmpRender = $this->controller->autoRender;
// Render the plaintext email body.
ob_start();
$this->controller->output = null;
$body = $this->controller->render($this->viewPath . DS . $view . '_text', $this->layout . '_text');
ob_end_clean();
// Restore the layout, view, output, and autoRender values to the controller.
$this->controller->layout = $tmpLayout;
$this->controller->action = ""> $this->controller->output = $tmpOutput;
$this->controller->autoRender = $tmpRender;
return $body;
}
// Temporarily store vital variables used by the controller.
$tmpLayout = $this->controller->layout;
$tmpAction = $this->controller->action;
$tmpOutput = $this->controller->output;
$tmpRender = $this->controller->autoRender;
// Render the plaintext email body.
ob_start();
$this->controller->output = null;
$body = $this->controller->render($this->viewPath . DS . $view . '_text', $this->layout . '_text');
ob_end_clean();
// Restore the layout, view, output, and autoRender values to the controller.
$this->controller->layout = $tmpLayout;
$this->controller->action = ""> $this->controller->output = $tmpOutput;
$this->controller->autoRender = $tmpRender;
return $body;
}
this is from swift_mailer
I'm thinking of making something like this in my app.
I hope it helps.
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.-------- Original Message --------
Subject: Re: $webroot of helper doesn't set by App::import
From: John Andersen <[email protected]>
Date: Fri, February 26, 2010 10:08 am
To: CakePHP <[email protected]>
What are you trying to do?
I would never use a Helper in a model, a helper is supposed to be used
in a View!
So please try to describe what you want to accomplish with a Helper in
the Model!
Enjoy,
John
On Feb 26, 5:59 am, maya <[email protected]> wrote:
> Hi,
>
> Im using Form helper in a Model like this.
>
> > App::import('Helper','Form');
> > $form = new FormHelper();
>
> But $form->webroot is NULL, it is not able to read.
> Is it a bug or by design?
>
> Thanks,
>
> --
> maya
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
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
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
