开发者

Smarty Variables

开发者 https://www.devze.com 2023-01-24 11:27 出处:网络
I\'m building a CodeIgniter application and using Smarty as my templating system. Instead of trying to assign Smarty variables from various controllers, would i开发者_运维问答t be better to define all

I'm building a CodeIgniter application and using Smarty as my templating system. Instead of trying to assign Smarty variables from various controllers, would i开发者_运维问答t be better to define all the Smarty variables in one place (e.g. a controller super-class) so that everything is in one place? My concern with this approach is that assigning variables not needed for a particular controller/view pair might degrade performance.

Ideas?


All in one place != Good

Keep your template variable assignments by the code that's assigning them. Not only will this be way simpler to maintain, it makes more sense because it should be the controller assigning the template variables directly (not through some intermediary). Also, more than one controller could use a template and they could be assign variables via different rules.

0

精彩评论

暂无评论...
验证码 换一张
取 消