CI How-to: Load global data in a view across all controllers

One the first issues I encountered with CodeIgniter was that I wanted to be able to use the same dynamic data in my header view across all controllers. And, I didn't want to repeat myself in each controller to load the model data that needed to be persistent site wide. For example, see the twitter feed in the header? I didn't want to have to do something like this in each method of every controller.

There is too much repetition here, so let's streamline the process. Start by creating a file in ./system/application/libraries/MY_Controller.php. When you prefix it with "MY_", CI will automatically load the file because it thinks you want to extend the base class. We do. Win.

The "entry_list" view in this example will have both the global $twitter and the local $will_it_blend data variables set. While trolling the CodeIgniter forums, I also came across Template Library for CodeIgniter which looks to be even more über. But I think it might be overkill for what I'm after today.