First off: I do realize that using models in a view is against the MVC hierarchy – but that’s the smoothest solution I’ve found so far.
I’ve integrated Smarty into my CodeIgniter CMS application. One of its features is the usage of templates along with minifying static content such as CSS and JavaScript. Hence, I’m trying to do something like this in the template file:
//Adding the static content
<?php
$this->content->css( array('my.css', 'style.css') );
?>
<html>
<head>
//Displaying the now minified static content
<?php $this->content->display() ? >
</head>
</html>
Since the final template should be editable by the end user or similar, I believe that this is the most simple solution.
Appreciating all input!
I think you shouldn’t use any codeigniter-releated function in Smarty-templates. The CSS directory is constant so unnecessary to call a php-function.
If you’ll need some information from CI, you’ll
assignto a smarty-variable in your controller-function – so doesn’t break MVC:As jco wrote above in simple cases CI&Smarty maybe “overkill”. But same cases it’s very useful (e.g. template inheritance and blocks can use to create same form-types).