Tutorial Details
- Topic: CodeIgniter, Controllers, PHP
- Difficulty: Moderate
- Format: Screencast and Written
Download Source Files
This Premium video, and companion article will teach you how to create a simple, yet powerful library to handle layouts in the popular CodeIgniter framework. The library you’ll create will allow you to maximize your efficiency, save time and code, modularize your views and even your Javascript and CSS files.
The basic functionality of this library will be very simple. We’ll take the contents of a view, render them with the appropriate data, then take the rendered content and assign it to a variable. Now, we’ll render the layout itself, and replace a part of the layout with the contents of this variable. Simple, but powerful enough.
The idea is to mimic the calls to $this->load->view(). When we call this method, we pass the name (and location) of our view, and then an array of data that will be accessible from the view. Here’s an example:
function method($url_param)
{
$this->load->view('controller_views/method_view', array('url_param' => $url_param));
}
The above code will take the file system/application/views/controller_views/method_view.php, pass it the
…Become a Premium member to follow along with this screencast/article and find out!
Join Net Premium

For those unfamiliar, the family of Tuts+ sites runs a premium membership service. For $19 per month, you gain access to exclusive premium tutorials, screencasts, and freebies from Nettuts+, Psdtuts+, Aetuts+, Audiotuts+, Vectortuts+, and CgTuts+ For the price of a pizza, you’ll learn from some of the best minds in the business. Become a Premium member to read this tutorial, as well as hundreds of other advanced tutorials and screencasts.
- http://www.sz-media.org Sz-Media
- lugger
- Adrian
- Nathan II
- Adrian
- Nathan II
- http://www.kotretan.com imamiscool
- Brad
- Sid
- Paul du Long
- Filip Kostovski
- http://codemonkeys.biz webdevguy
- Brian Ray
- http://Lavishimage.com Imamu Hunter
- Carlos
- Guilherme Ventura
- arnold
- Denis Bazhan (db)
- Eddy
- http://www.tkp.com.br/ Thiago
- Guilherme Ventura
- http://www.incisivepoint.com Jack Starr
- http://sig.ly/ Nico
- Jon-Erik
- http://mixmo-anime.blogspot.com kankuro
- Premium
- http://spotdex.com David
- Tom Van Assche
- http://www.ilyassalmanfilmleri.org İlyas Salman
- wburningham
- http://www.net2011.com hbnu001
- Alexander
- sadasdasd
