Professional CodeIgniter

(singke) #1

Chapter 3: A 10,000 - Foot View of CodeIgniter


55


Template Parser — The Template Parser library must be loaded. Use this library to create
templates that contain parsable pseudo - templates. If you are familiar with Smarty, you ’ ll find
that CodeIgniter ’ s templating isn ’ t as feature - rich but is still very useful.

Trackback — The Trackback library must be loaded. Use this library to send and receive
Trackback data.

Unit Testing — The Unit Testing library must be loaded. Use this class to unit test functions in
your application. CodeIgniter provides an evaluation function and two result functions in this
library.

URI Class — The URI Class library is loaded automatically. You ’ ll use this library a good deal,
especially when you ’ re parsing URLs, breaking them into segments that can then be passed to a
controller or saved as variables.

User Agent — The User Agent library must be loaded. Use this library to identify the browser,
mobile device, or robot visiting your site. You can also use it to detect supported languages,
character sets, and even referrers.

Validation — The Validation library must be loaded. Use this library to validate form input in
your applications. You get plenty of opportunities in this book to explore this library.

XML - RPC — The XML - RPC library must be loaded. Use this library to set up XML - RPC clients
and servers.

Zip Encoding — The Zip Encoding library must be loaded. Use this library to create Zip archives
of both text and binary data.

At this point in your CodeIgniter career, it would be pointless to cover each of these libraries in detail.
Instead, as the projects in this book unfold, you are introduced to relevant libraries when the time is right.

However, there are two libraries that need some discussion now, both to make you more familiar with
them and to give you an idea of how to work with them. The two libraries in question are Database and
Session.

The Database Library


The Database library contains a series of helpful functions that make it easy for you to create and run
queries and process the result sets from those queries.

The first thing to note about the Database library in CodeIgniter is that it allows you to pass in simple
SQL queries. At the end of the day, many people who are new to CodeIgniter find this to be a great
comfort. Although some of the built - in Active Record patterns provide helpful shortcuts, just knowing
that you can bypass all of that and send in a complex query is worth its weight in gold:

$sql = “select a.name, a.id, b.groupname
from persons a, groups b
where a.group_id = b.id
group by b.groupname, a.name”;

$Q = $this- > db- > query($sql);

❑ ❑ ❑ ❑ ❑ ❑ ❑ ❑

Free download pdf