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 assign
to a smarty-variable in your controller-function - so doesn't break MVC:
$smarty->assign(array(
"display" => $this->content->display(),
"css_include" => $this->content->css(array("my.css","style.css"))
));
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).
I've used both smarty and codeigniter and in my experience using both is overkill. Smarty just mucks up your code and IMHO is cumbersome to use.
Think of codeigniter views as the equivalent of your smarty templates.
If you are worried about minification you could try using something like this: CSS Minification Library
Hope this is helpful.