PHP Classes

Do not write logic in view files

Recommend this page to a friend!

      PHP HTML to PDF Conversion in CodeIgniter  >  All threads  >  Do not write logic in view files  >  (Un) Subscribe thread alerts  
Subject:Do not write logic in view files
Summary:Better if you can write logic in controller or model
Messages:2
Author:Muhammed Anas. I
Date:2015-11-23 14:41:33
 

  1. Do not write logic in view files   Reply   Report abuse  
Picture of Muhammed Anas. I Muhammed Anas. I - 2015-11-23 14:41:33
The effort is much appreciated. I have a suggestion.

CI can render a view page to a variable inside controller (createpdf.php) by passing an additional parameter to load view function as follows.

$this->load->view('pdfreport', $data, true);

Then you can shift the pdf conversion logic from view file to controller or model file itself.

  2. Re: Do not write logic in view files   Reply   Report abuse  
Picture of Pravin Sonawane Pravin Sonawane - 2015-11-24 04:48:15 - In reply to message 1 from Muhammed Anas. I
Thanks for the suggestion Muhammed