Welcome Guest, Not a member yet? Register   Sign In
Passing Variables to a load->file call
#2

[eluser]jmb727[/eluser]
Yeah create your email in one view file and your message body in another.

E.g.

Code:
class A_controller extends CI_Controller
{
    public function __construct() {
        parent::__construct();
    }

    public function index() {
        //
    }
    
    public function createEmail($bodyVars)
    {
        $data = array();
        $data['body'] = $this->load->view('email/body', $bodyVars, TRUE);
        $this->load->view('email/layout', $data);
    }
}

In the function $this->load->view('email/body', $bodyVars, TRUE) the third argument is a boolean which determines whether the view file should be returned as a string or not. It defaults to FALSE which means it gets printed to the screen, however set it to TRUE and it will load the data you pass into it (i.e. $bodyVars) and return the view file into a variable.


Messages In This Thread
Passing Variables to a load->file call - by El Forum - 05-24-2011, 11:53 AM
Passing Variables to a load->file call - by El Forum - 05-24-2011, 02:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB