Welcome Guest, Not a member yet? Register   Sign In
Can't load view as variable
#3

(11-26-2020, 07:01 AM)sammyskills Wrote: Hi,

Are you sure you're not calling the _display() function somewhere in your code?

BTW, you should show you full code so that it can be easy to debug.
Thanks for the speedy response. Here is the full controller, credentials removed. I appreciate it's not the cleanest code.



PHP Code:
public function send_quote ($job_id)
 {

$this->output->enable_profiler(TRUE);

if (!
$this->ion_auth->logged_in())
{
// redirect them to the login page
redirect('auth/login''refresh');
}
else {

$this->load->library('email');

$config = array();
$config['protocol']  'smtp';
$config['smtp_host'] = 'smtp.googlemail.com';
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'xxxxxxxx';
$config['smtp_port'] = 465;
$config['charset']  'iso-8859-1';
$config['mailtype']  'html';
$config['newline']  '\r\n'
$config['smtp_crypto'] = 'ssl';
$config['crlf'] = '\r\n';
$config['wordwrap'] = TRUE;

$this->email->initialize($config); 



$this->email->set_header('MIME-Version''1.0; charset=utf-8');
$this->email->set_header('Content-type''text/html');



if (
$this->jobs_model->get_by_id($job_id)->email !== '') {
$to_email $this->jobs_model->get_by_id($job_id)->email;

}
else {
$data['error'] = ($this->email->print_debugger());
$this->load->view('error',$data);

}

$subject 'Quote #' $job_id;

$data['job_id'] = $job_id;
$data['jobs'] = $this->jobs_model->get_by_id($job_id);
$data['line_items_count'] = $this->orders_model->count_line_items($job_id);

if (
$data['line_items_count'] !== 0) {
echo 
'<div class="col-md bg-success text-white text-center">Line items are present.</div>';

for (
$i=0$i $data['line_items_count']; $i++) { 
$data['line_items'] = $this->orders_model->get_line_items($job_id);
}

$quote_id uniqid() . uniqid(''true);

$this->email->from($config['smtp_user'], "calondon");
$this->email->to($to_email);
$this->email->subject($subject);
$this->email->CC('[email protected]); 

$body = $this->load->view('
jobs/send_quote', $data, TRUE);

$this->email->message($body);




if($this->email->send()) {
echo '
<div class="col-md bg-success text-white text-center">Quote sent successfully.</div>';
$job_data = array ('
quote_sent' => 1, 'quote_id' => $quote_id);

$this->db->where('
job_id', $job_id);

if ($this->db->update('
jobs', $job_data)){
echo '
<div class="col-md bg-success text-white text-center">Job updated.</div>';
}
else {
echo '
<div class="col-md bg-success text-white text-center">Job could not be updated</div>';
}
}
else {
echo '
<div class="col-md bg-success text-white text-center">Email could not be sent</div>';
}

}
else {
echo '
<div class="col-md bg-success text-white text-center">There are no line items</div>';
}

}

Reply


Messages In This Thread
Can't load view as variable - by calondon - 11-26-2020, 03:41 AM
RE: Can't load view as variable - by sammyskills - 11-26-2020, 07:01 AM
RE: Can't load view as variable - by calondon - 11-26-2020, 07:46 AM
RE: Can't load view as variable - by neoneeco - 11-26-2020, 07:48 AM
RE: Can't load view as variable - by InsiteFX - 11-26-2020, 01:23 PM



Theme © iAndrew 2016 - Forum software by © MyBB