Friday, February 26, 2010

Re: $webroot of helper doesn't set by App::import

I found url() method in Helper class.
Even if webroot is null, it returns relative/full URL.

Thanks,

--
maya


On Sat, Feb 27, 2010 at 2:22 AM, <alan@asteriskpound.com> wrote:
> 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 = $tmpAction;
>         $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.
>
> -------- Original Message --------
> Subject: Re: $webroot of helper doesn't set by App::import
> From: John Andersen <j.andersen.lv@gmail.com>
> Date: Fri, February 26, 2010 10:08 am
> To: CakePHP <cake-php@googlegroups.com>
>
> 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 <maya.neg...@gmail.com> 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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: