Welcome Guest, Not a member yet? Register   Sign In
E-Mail is being printed to screen as well as being sent. Odd.
#1

[eluser]johnwbaxter[/eluser]
I've got a controller that sends an e-mail, then does some other stuff which loads a view that has a form in it which has some javascript that submits that form on page load. Don't ask me why, it just does!

Anyway, the e-mail gets sent fine, but when it loads the view it also prints the (html) e-mail to the page.

I really need to stop it doing this.

Here's some code.

Code:
$this->load->library('email');
            $this->load->library('parser');
            $this->email->from('[email protected]','Our Name');
            $this->email->to($email);
            $this->email->bcc('[email protected]');
            $this->email->subject('Our Name '. $insertorderdata->orderid);

            $emaildata = array(
                                          'ordername' => $insertorderdata->ordername,
                                          'order_number' => $insertorderdata->orderid,
                                          'order_date' => date ("d/m/Y", strtotime($insertorderdata->timestamp)),
                                          'order_status' => 'Pending',
                                          'company' => $emailrow->CompanyName,
                                          'first_name' => $emailrow->FirstName,
                                          'surname' => $emailrow->Surname,
                                          'job_title'=> $emailrow->JobTitle,
                                          'address_1' => $emailrow->AddressLine1,
                                          'address_2' => $emailrow->AddressLine2,
                                          'town' => $emailrow->Town,
                                          'county' => $emailrow->County,
                                          'postcode' => $emailrow->Postcode,
                                          'tel' => $emailrow->Telephone,
                                          'email' => $emailrow->username,
                                          'subtotal' => $insertorderdata->exc_vat,
                                          'vat' => $insertorderdata->vat,
                                          'total' => $insertorderdata->price,

              );
            $message = $this->parser->parse('email_templates/confirm_email.php',$emaildata);
            $this->email->message($message);
            $this->email->send();

Then it gets some data together and fires up a view:

Code:
$this->load->view('test', $data);

Then i do some of this madness in the view:

Code:
<html>
<body>
<?=$payment_form?>
<div>
Some Text is in here.
</div>


&lt;/body&gt;
&lt;/html&gt;

Sooooo if anyone can shed some light on this gosh darned crazyness i would really appreciate some assistance.
#2

[eluser]johnwbaxter[/eluser]
I don't suppose anyone has any ideas on this do they!?
#3

[eluser]zimco[/eluser]
From the user guide:
Quote:There is no need to "echo" or do something with the data returned by $this->parser->parse(). It is automatically passed to the output class to be sent to the browser. However, if you do want the data returned instead of sent to the output class you can pass TRUE (boolean) to the third parameter:

Just a guess: maybe it has something to do with the data automatically being passed to the output class and sent to browser from the parser class, or perhaps you have a debugging type echo statement in code you have not shown us that you have forgotten about?
#4

[eluser]johnwbaxter[/eluser]
Yeah you're right, someone just helped me with that on irc and i hadn't gotten round to closing this.

Thanks a lot for the reply though!




Theme © iAndrew 2016 - Forum software by © MyBB