I am using CodeIgniter with Template Library and have set up my template view file. Part of my template that doesn't change from page to page displays data from a database.
What is the best way to includ开发者_如何学运维e this data in my template?
If the content doesn't change very often, something like the user's name, I would store it in the session and call it from there. Otherwise, if you really need to query it on every page request, I would create a base controller (MY_Controller) then create and assign a protected var that you can access from your controllers.
精彩评论