I am using codeigniter for my website and I was wondering if I could load a view in a view without using PHP. So like a Template Parser, is it possible to run this code:
<div>
<?php $this->load->view('widget'); ?>
</div>
with plain text like:
<div>
{loadview:widget}
</div>
Tnx
Sorry, but there’s nothing built in to Codeigniter that does this. You’ll have to look at using a third party template parser or write your own.
Some suggestions:
With CI’s native template parser, you can assign a variable that contains the content:
The third param as
TRUEbuffers the output so you can use it in a variable without it printing. Then in your view:..but currently, CI’s parser has very limited capabilities. I’d go with Twig or Smarty.