We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Assign view to a variable

Hi all

i want to send an email , and there will be html . On codeigniter i can make with that

$html_email = $this->load->view($this->theme.'mail/davetiye_mail_header', $data, true);
$html_email .= '    <tr>
    <td><a href="'.base_url().'"><img src="'.$this->mail_theme_url.'i/davetiye/ust.jpg"  /></a></td>
</tr>';
$this->email_send($html_email);

i mean i dont want to set html in controller so i want to assign it on variable and then send it . How can i make that?

edited Oct '14

I've done something like in this way:

$this->view->pick('view');
$this->view->disableLevel(View::LEVEL_MAIN_LAYOUT);
die($this->view->getRender('view', params);

I hope it helps!



39.3k

i will assign $html = $this->view->getRender('view',array()) ?