• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CodeIgniter Simple and Secure Twig

#25
(02-21-2016, 09:41 PM)kenjis Wrote:
(02-21-2016, 06:15 PM)thocutt1020 Wrote: I think this is awesome library Kenji!

Is there any way in Codeigniter 3.x to render a twig template from within a twig?

For instance if I had inside my twig something like... 

{{ render('season_controller/champions', {'season_id': season.season_id}) }}

It would call my controller and display the output inside the twig. 
If I could do this it would be awesomely handy.
Is this possible?

That is calling another controller (from a contorller). CodeIgniter does not support it.
It is limitation (and design) of CodeIgniter.

To make it possible, first, you have to hack CodeIgniter. And I don't
recommend it unless you are an expert of CodeIgniter.

Thanks for your response!
I see what you are saying...
maybe I can get the functionality I want by creating helper functions and then calling them from within the twig. I will try that.

One other question I was wondering about.
With views, you used to be able to store the output in a variable i.e..
 $string = $this->load->view('myfile', '', true);

Can you achieve same result with twig?
 $string = $this->twig->display('myfile.html', '', true);
Reply


Messages In This Thread
CodeIgniter Simple and Secure Twig - by kenjis - 05-24-2015, 07:06 PM
RE: CodeIgniter Simple and Secure Twig - by thocutt1020 - 02-21-2016, 11:26 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.