CodeIgniter Forums
View Parser + View Layout - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=31)
+--- Thread: View Parser + View Layout (/showthread.php?tid=73578)



View Parser + View Layout - luispastendev - 05-11-2019

Hi guys!

I want to work with view parser and view layout, so I see view parser does not interpret php code to create a layout. what would be a good practice to solve this problem. I have handled it in this way and it works.

 
PHP Code:
  $parser service ('parser');
 
  $data['news'] = $this->model->getNews();
 
  $page['page'] = $parser->setData($ data)->render('pages/overview');
 
  echo view('templates/layout',$page); 


Any ideas to work with these 2 things?

regards!