Welcome Guest, Not a member yet? Register   Sign In
what $string = $this->load->view('myfile', '', true) exactly does?
#8

[eluser]JoostV[/eluser]
A simple example: create an email.

CONTROLLER
Code:
// Set data dynamically
$data['yourname'] = 'John';

// Load mailcontent as string, spiked with dynamic data
$mail_content = $this->load->view('mail', $data, TRUE);

// Send e-mail, using the generated mailcontent
$this->load->library('email');
$this->email->from('[email protected]', 'Your Name');
$this->email->to('[email protected]');
$this->email->subject('Email Test');
$this->email->message($mail_content);
$this->email->send();

VIEW mail.php
Code:
Hello <?php echo $yourname; ?>
Today is <?php echo date('d M Y'); ?>. Just so you know.
Sincerely, me

Other examples: get an invoice as string from a view and store it, create an XML from view and send it as attachment, etc.


Messages In This Thread
what $string = $this->load->view('myfile', '', true) exactly does? - by El Forum - 08-20-2010, 05:16 AM



Theme © iAndrew 2016 - Forum software by © MyBB