CodeIgniter Simple and Secure Twig |
Hi, I built A Simple and Secure Twig integration for CodeIgniter 3.0.
https://github.com/kenjis/codeigniter-ss-twig This is really simple implementation. Try it, if you like.
Probably you have to add the paths for view files:
https://github.com/kenjis/codeigniter-ss...ig.php#L35
Hi Kenjis,
I'm interested in including Twig the proper way with CI3.0, but I can't seem to get it to work. I am NOT using composer. How may I get this to work?
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
(10-01-2015, 06:49 AM)iamthwee Wrote: Hi Kenjis, Why not use Composer? Without Composer to install Twig is a lot of pain. First you read the Twig documentation: http://twig.sensiolabs.org/doc/installation.html Install tarball release, and you must register Twig Autoloader with spl_autoload_register(): https://github.com/twigphp/Twig/blob/1.x...loader.php And install my Twig library: https://github.com/kenjis/codeigniter-ss...s/Twig.php I think you can use Twig if you install it this way, but I have not installed Twig manually like this.
Thanks, I refuse to use composer. Too much auto downloading of things and stuff in the background which bugs me. (I'm anal about control, stuff I can download unzip and use and see)
In the end I managed to get it sorted by copying the relevant files from https://github.com/Vheissu/Ci-Twig I then downloaded the zip from twig's website which has the Autoloader.php file and dropped it in the third party library and it worked like a charm. Now I just have to put it into my ignitedCMS project and test if it all sings together nicely which I'm sure it will.
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
It registers Twig autoloader:
https://github.com/Vheissu/Ci-Twig/blob/...hp#L34-L38
Yes but what I was doing was using the twig zip file from here:
https://github.com/fabpot/Twig/tree/master/lib/Twig Looks like he forked it and removed Autoloader.php, so that was why it was failed. When I downloaded the zip from the twig website it had autoloader.php and worked. Thanks for all your help. I might not even use templates now, still in a critical decision phase.
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
Twig autoloader is deprecated: See https://github.com/twigphp/Twig/blob/1.x...er.php#L19
If you use Twig, I recommend you know Twig itself. My Twig.php and Vheissu/Ci-Twig are just wrappers. And I also recommend you think how to HTML-escape in views. In my opinion, escaping manually (every time you call html_escape() in views when you need) ends up with a lot of XSS vulnerabilities. |
Welcome Guest, Not a member yet? Register Sign In |