Integrate Smarty Template Parsing into CodeIgniter |
[eluser]Aken[/eluser]
https://github.com/cryode/CodeIgniter_Smarty Visit the Github page to download the code and view the basic installation instructions. Also make sure to read the Smarty documentation for how to set up your view files to use Smarty features. v1.1.0 -- March 12, 2013 - Smarty updated to version 3.1.13 - New auto-escape variables feature - $ci global var changed to $CI - CI 3.0 VIEWPATH constant used, when available - Licensed properly! I like to use Smarty due for its templating context, rather than using PHP tags, as well as the ability to easily set up things like common header/footers, etc, without doing it in your controllers or other PHP areas. I've always used Smarty in a pretty basic way, so I haven't integrated some of the fancier features quite yet. But I'm in the process of adding / playing / testing, and will continually add and/or optimize the code as I see fit. I don't think I'll need to do much support for this basic install, but if anyone has questions, please let me know. Also please suggest any features you might like, or bugs if you happen to spot one. Cheers!
[eluser]Aken[/eluser]
I've seen a couple other topics involving Smarty pop up lately - just though I'd bump this as another option for those wishing to utilize Smarty in their CodeIgniter install.
[eluser]Abel A.[/eluser]
I get this error when smarty compiles a template: Code: A PHP Error was encountered it's a fresh installation of CI w/ only your smarty plugin
[eluser]weboap[/eluser]
thats a message from your php. in your php.ini add this line date.timezone = PST or add to your config/config.php date_default_timezone_set('America/Los_Angeles');
[eluser]Abel A.[/eluser]
[quote author="weboap" date="1337825814"]thats a message from your php. in your php.ini add this line date.timezone = PST or add to your config/config.php date_default_timezone_set('America/Los_Angeles'); [/quote] perfect, thanks
[eluser]Abel A.[/eluser]
I think I found a bug: You can't load a view outside the CI_Controller class. Example: Code: class Core { In theory when $this->core->msg($msg) is called within a controller, the view should be loaded from the msg function. Is this a bug? or am I using CI improperly?
[eluser]Aken[/eluser]
What is Core supposed to be, a library? You don't typically want to do any view loading or things of that nature inside libraries. I also don't know what's wrong if you don't post an error or something. exit() is also likely preventing the output class from displaying the view you just tried to load. My advice would be to not do things that way in the first place.
[eluser]weboap[/eluser]
@berkguy i think you will have to do some reading budy! start here http://codeigniter.com/wiki/Category:Help::Tutorials
[eluser]Jagar[/eluser]
Hi Aken, Thanks for creating this tutorial for Smarty. I had configured smarty to work with CI but since I have upgraded to the latest version that doesn't work anymore. So your tutorial came to the rescue. I have used your code and it seem to be working almost, but now I get the following messages Code: A PHP Error was encountered Also I have the following on Code: $config['log_threshold'] = 1 Thanks |
Welcome Guest, Not a member yet? Register Sign In |