Codeigniter 3.x + Smarty |
Have anyone had any luck making smarty 3.x + ci 3.x work together?
I tried http://www.phpclasses.org/blog/post/261-...ether.html and tried: http://www.coolphptools.com/codeigniter-smarty but both links are for codeigniter 2.x, and i would like to use this template engine. Thanks (03-20-2015, 09:48 AM)poseso Wrote: Have anyone had any luck making smarty 3.x + ci 3.x work together? Hi, i don't tried much, but you need make this. - Download the last smarty compilation http://www.smarty.net/download - Next step path system/libraries create folder Smarty and put inside the smarty compilation - path system/libraries create Smarty.php with this code: Code: <?php - Next, put inside this path application/views/ the folders 'templates' and templates_c - Finally run this in autoload.php (application/config/autoload.php) Code: $autoload['libraries'] = array('smarty'); - And create your controller like this: Code: public function index() - Show data in template: Code: {$title}
Was there anything else that you did to get this to work?
I have followed the instructions but getting Code: An uncaught Exception was encountered The following is my controller for Test PHP Code: <?php Thank you (09-20-2015, 07:02 PM)Jagarm Wrote: Was there anything else that you did to get this to work? I had the same problem but I fixed it downloading Smarty version 3.1.27. Please, try to download it : https://github.com/smarty-php/smarty/arc....27.tar.gz
Hi,
Use $this->setTemplateDir(APPPATH . "/views/templates/"); instead of $this->template_dir = APPPATH . "/views/templates/";
In the above code shared.. it worked fine
but when tried to use some advanced concepts like template inheritance http://www.smarty.net/docs/en/advanced.f...itance.tpl its giving me issue when tried to add "extends" in $this->smarty->view function its just dumping on screen the extends file name provided and nothing else. Let me know if anyone had a success in implementing these concepts -Abhijeet
I updated my code at http://www.coolphptools.com/codeigniter-smarty to work with CodeIgniter 3.0 and Smarty 3.x . Please let me know if you find any issues with the new code.
|
Welcome Guest, Not a member yet? Register Sign In |