Home >Documents >5 Reasons To Love CodeIgniter

5 Reasons To Love CodeIgniter

Date post:21-Dec-2014
View:1,432 times
Download:0 times
Share this document with a friend

5 Reasons To Love Code Igniter

5 Reasons To Love CodeIgniter

Who Is This Guy?Nic Rosental, web developer and owner of coworking space Cobb Exchange.

You can find me in all of these placeshttp://[email protected]@gmail.com

Free month to everyone thats here tonight. If you leave intown let me know and Ill hook you up with a free month at Strongbox.2Everyone Loves Their Framework

Devotion to framewroks is almost like sports teams or religion. In truth you should pick the one that better suits your needs and style, not the one that has the most hype.3What Is CodeIgniter?Its an MVC framework.MVC stands for Model View Controller and its a logical way of organizing an application. Models interact with the databaseControllers take care of the logicViews present the outputCodeIgniter doesnt force you to do things this way, it enables you to do so. Why CodeIgniter?According To MeMost frameworks will help you write better code faster. CodeIgniter will help you do that without forcing you into some intricate, and weird way of doing things.

According To EllisLab (creators of CI)helps you write kick-ass PHP programs

How many of you tried to start using a framework and were frustrated by how it forced you to change your coding style?5Submit URIs To Your WillOne of the foundations of CI is clean URLs. Nice looking, well organized URLs, without any of the ugliness of query strings.Uglyatlantaphp.org/presenters.php?action=display&name=nicPrettyatlantaphp.org/presenters/display/nicHow Does it Work?Its a thing of beauty, really.

class Presenters extends Controller{function display($var){echo $var;}


//Echoes nic

The controller will interpret the first segment after the controller name (the second segment) as a variable passed to the function. You can pass as many variables as you need using this method, but careful, if you require the variables and they arent present youll get an error as usual.Explain how to pass a second var7Need More Control?Why yes, theres a class for thatatlantaphp.org/archives/show/picture/1234

$this->uri->segment(3); //picture$this->uri->segment(99,0); //Returns 0 instead of FALSE$this->uri->uri_to_assoc(); //[array](picture => 1234)$this->uri->uri_string(); // /archives/show/picture/1234$this->uri->total_segments(); //4

There are several more functions to play around with.

Enter the URI class. The URI class lets you pick and choose from the URI segments, and do other cool manipulations. The URI class is autoloaded, so you can call it without declaring it first.By default uri_to_assoc starts at segment 3 assuming the first two are controller/function

8Form and Data ValidationThe Form view

Click here to load reader

Reader Image
Embed Size (px)