<p><strong>A Little Background Information</strong>:<br>
I've been looking at a few PHP framework recently, and it came down to two. The Zend Framework or CodeIgniter. </p>

<p>I prefer CodeIgniter, because of its simple design. It's very bare bone, and it is just kept simple. The thing I don't like though is the weak template system. The template system is important for me, because I will be working with another designer. Being able to give him a good template system is a big plus.</p>

<p>Zend was the second choice, because of the better template system that is built in. Zend is a different beast though compared to CodeIgniter. It emphasis "loose coupling between modules", but is a bigger framework. I don't like to feel like I have many things running under the hood that I never use. That is unnecessary overhead in my opinion, so I thought about putting a template system into CodeIgniter: Smarty.</p>

<p><strong>Question(s)</strong>: How easy/hard is the process to integrate Smarty into CodeIgniter? From my initial scan of the CodeIgniter documentation, I can see that the layout of the framework is easy enough to understand, and I anticipate no problems. I want to know if anyone has used it before, and therefore are aware of any "gotchas" you my have experienced that is going to make this harder than it should be or impossible to pull off. I also want to know if this is a good thing to do at all. Is the template system in CodeIgniter enough for normal use? Are there any other template modules that are good for CodeIgniter aside from Smarty? I better off with Zend Framework? Is any wheel being invented here?</p>

[{'answer_id': 41277, 'author': 'Favio', 'author_id': 353971, 'author_profile': 'https://Stackoverflow.com/users/353971', 'pm_score': 1, 'selected': False, 'text': '<p>I did a quick google search and found the following:\n<a href="http://devcha.blogspot.com/2007/12/smarty-as-template-engine-in-code.html" rel="nofollow noreferrer">http://devcha.blogspot.com/2007/12/smarty-as-template-engine-in-code.html</a>\n<a href="http://codeigniter.com/forums/viewthread/67127/" rel="nofollow noreferrer">http://codeigniter.com/forums/viewthread/67127/</a></p>\n\n<p>If the designer is not familiar with Smarty, I think it\'s almost the same as if you use the existing CodeIgniter templating system (which leaves everything to PHP actually). It also depends on the complexity of the project at hand.</p>\n\n<p>You can also hook Smarty with Zend Framework. It\'s more complex than with CodeIgniter, but there\'s already a primer on how to do exactly that in the ZF documentation. <a href="http://framework.zend.com/manual/en/zend.view.scripts.html" rel="nofollow noreferrer">http://framework.zend.com/manual/en/zend.view.scripts.html</a>  Plus lots of tutorials on the net.</p>\n\n<p>In my opinion it\'s almost the same, you can use pure PHP or Smarty as your template "engine", so it depends on the project. Also, compare a developer who has extensive experience and already has a library of view helpers so she uses pure PHP, versus a designer who doesn\'t know anything about PHP, but has extensive experience with Smarty. Sometimes decisions have to be based on who is going to do what.</p>\n'}, {'answer_id': 57491, 'author': 'Dave Gregory', 'author_id': 5677, 'author_profile': 'https://Stackoverflow.com/users/5677', 'pm_score': 2, 'selected': False, 'text': "<p>Slightly OT, hope you don't mind...</p>\n\n<p>I'm a Zend Framework user and I think it's worth saying that the loose coupling means you don't need to include any files you're not actively using.  Hopefully this negates your concern about unnecessary overhead.</p>\n\n<p>With the layouts stuff added in a recent release of ZF, its templating is really hard to fault... and it's completely pluggable as Favio mentions.  The more I use ZF, the more I like it; they do things the way I would do them!</p>\n"}, {'answer_id': 618961, 'author': 'JayTee', 'author_id': 20153, 'author_profile': 'https://Stackoverflow.com/users/20153', 'pm_score': 2, 'selected': False, 'text': '<p>Sorry to resurrect an old question - but none of the answers have been flagged as "accepted" yet.</p>\n\n<p>There\'s a library called "template" that does a great job of allowing you to use just about any template parser you want:</p>\n\n<p><a href="https://github.com/jtrelfa/CITemplate" rel="nofollow noreferrer">Template CI Library - V1.4.1</a></p>\n\n<p>The syntax is pretty easy for integrating into your CI application and the smarty integration spot on.</p>\n'}, {'answer_id': 1205021, 'author': 'Randell', 'author_id': 106778, 'author_profile': 'https://Stackoverflow.com/users/106778', 'pm_score': 0, 'selected': False, 'text': '<p>Check out this <a href="http://codeigniter.com/forums/viewthread/94035/" rel="nofollow noreferrer">custom CodeIgniter templating library</a>.  I\'ve already used it on several projects and it is easy to use. I know this post is late but it\'s worth checking out.</p>\n'}, {'answer_id': 4331360, 'author': 'Dwayne Charrington', 'author_id': 302318, 'author_profile': 'https://Stackoverflow.com/users/302318', 'pm_score': 0, 'selected': False, 'text': '<p>It doesn\'t appear there has been an answer selected for this question nor has an up-to-date solution been given to work with the latest version of Codeigniter (2.0) and the latest version of Smarty (3.0.5).</p>\n\n<p>This library allows you to use Smarty 3 with Codeigniter 2.0 so you can use Smarty 3 specific features like template inheritance.</p>\n\n<p><a href="http://ilikekillnerds.com/2010/11/using-smarty-3-in-codeigniter-2-a-really-tiny-ci-library/" rel="nofollow">http://ilikekillnerds.com/2010/11/using-smarty-3-in-codeigniter-2-a-really-tiny-ci-library/</a></p>\n'}, {'answer_id': 30263642, 'author': 'Luca Mori Polpettini', 'author_id': 2270716, 'author_profile': 'https://Stackoverflow.com/users/2270716', 'pm_score': 0, 'selected': False, 'text': '<p>Integrating Smarty in CodeIgniter? It is a breeze!\nThe <a href="http://www.codeigniter.com/user_guide/libraries/parser.html" rel="nofollow">template system in CodeIgniter</a> is very basic.</p>\n\n<p>Follow these steps for Smarty 3 in CI 3:</p>\n\n<p>Download CodeIgniter 3</p>\n\n<p>Download Smarty 3 and put its content in    \'application/third_party/smarty\' folder</p>\n\n<p>Create \'Custom_smarty.php\' file in \'application/libraries\' and add    this code:</p>\n\n<pre><code>&lt;?php\nif ( ! defined(\'BASEPATH\')) exit(\'No direct script access allowed\');\n\nrequire_once(APPPATH.\'third_party/smarty/Smarty.class.php\');\n\nclass Custom_smarty extends Smarty {\n\n  function __construct()\n  {\n    parent::__construct();\n    $this-&gt;setTemplateDir(APPPATH.\'views/templates/\');   \n    $this-&gt;setCompileDir(APPPATH.\'views/templates_c/\');\n  }\n}\n?&gt;\n</code></pre>\n\n<p>Create \'templates\' &amp; \'templates_c\' folders inside \'application/views\' folder</p>\n\n<p>Create simple \'test.tpl\' file in \'application/views/templates\' folder</p>\n\n<p>Open \'autoload.php\' in \'application/config\' folder and add: </p>\n\n<pre><code>$autoload[\'libraries\'] = array(\'custom_smarty\');\n</code></pre>\n\n<p>And inside a controller: <code>$this-&gt;custom_smarty-&gt;display(\'test.tpl\');</code></p>\n\n<p>If you are working on localhost set the permissions: <code>sudo chmod -R 777 templates_c</code>. Otherwhise contact your hosting service, if you catch the error Unable to write file. First be sure templates_c folder exists.</p>\n\n<p>Otherwise you can use another template engine like Twig.</p>\n'}]
['https://Stackoverflow.com/questions/41010', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2976/']