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

#1
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.
Do you want to write tests for your apps? Our book, CodeIgniter Testing Guide would help you.
Reply

#2
Hi kenjis,
 
Your code not work with CodeIgniter HMVC Modules.

How to fix it?

Thanks
Reply

#3
Probably you have to add the paths for view files:
https://github.com/kenjis/codeigniter-ss...ig.php#L35
Do you want to write tests for your apps? Our book, CodeIgniter Testing Guide would help you.
Reply

#4
Thank you! I fixed it!
Reply

#5
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
Reply

#6
(10-01-2015, 07:49 AM)iamthwee Wrote: 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?

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.
Do you want to write tests for your apps? Our book, CodeIgniter Testing Guide would help you.
Reply

#7
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
Reply

#8
It registers Twig autoloader:
https://github.com/Vheissu/Ci-Twig/blob/...hp#L34-L38
Do you want to write tests for your apps? Our book, CodeIgniter Testing Guide would help you.
Reply

#9
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
Reply

#10
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.
Do you want to write tests for your apps? Our book, CodeIgniter Testing Guide would help you.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


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