i'm rendering emails in a component like this:

function _render($viewName, $mailData)
{
        $oldLayout = $this->controller->layout;

        ob_start();
        $this->controller->set('maildata', $mailData);
        $this->controller->render(null, 'email', VIEWS.'email'.DS.
$viewName.'.thtml');
        $body = ob_get_clean();

        $this->controller->layout = $oldLayout;

        return $body;
}

in the controller it looks like this:

$this->Mailer->send('viewFile',array('key'=>
$key),'Subject','[EMAIL PROTECTED]','[EMAIL PROTECTED]']);

everything works as expected, hower once i called the render()
function in the component, i have to explicitly call the render
function in the controller to get any output i.e:

$this->render('controller_name');

i think it happens because the render function sets a flag
(_hasRendered) in the view. while i'm able to store/restore the
$layout before/after i render the email i can not do this with the
_hasRendered flag (it is private).

even if i would hack it, it is not clean: ob_start() / ob_get_clean()
is ugly as any side effects caused by calling render() will come into
my way.

is there a recommended way to call a 'low level' render() function in
cake 1.1.15.5144 without any side effects on my controller? i would
prefer to use the template engine of cakephp to create mails ... but
without side effects.

any thoughts are welcome!

thanx!


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" 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