Professional CodeIgniter

(singke) #1

Chapter 1: Welcome to the MVC World


22


Next, use the auto_typography() function in the view:

< html >
< head >
< title{title} < /title >
< link href=”{css}” rel=”stylesheet” type=”text/css”/ >
< meta name=”keywords” value=”{keywords}”/ >
< meta name=”description” value=”{description}”/ >
< /head >
< body >
< h1 > {title} < /h1 >
< p > < ?php echo auto_typography(“{bodycopy}”);? > < /p >
< /body >
< /html >

If you put five MVC experts in the same room and asked them to tackle this particular problem, you ’ d
probably get at least three different answers, if not more. But you get the idea: CodeIgniter is fairly easy
to work with, very flexible, and leaves you, the developer, with easily maintained, well - organized code
artifacts.

Conclusion


This chapter serves as a basic introduction to MVC and CodeIgniter ’ s place in that world. You ’ ve learned
about the concepts behind MVC and why you should use it, and been given a brief history lesson.
Specifically, you ’ ve learned how to transform a non - MVC application into a working CodeIgniter
application, with a simple model, controller, and view.

As you continue with the rest of the book, remember these key facts about Model - View - Controller
frameworks and applications:

Models maintain and update an application ’ s data.

Views display data and user interface elements.

Controllers handle user events that manipulate models and render or update views.

In CodeIgniter:

❑ Most of your work will be done in the controller.

❑ Views can be regular PHP files or parsed templates with pseudo - variables.

❑ Models aren ’ t required, but most of your applications will have them.

The next two chapters cover Agile development practices and provide a high - level overview of
CodeIgniter ’ s structure and installation process. By the time you finish with Chapters 1 – 3 , you ’ ll have
the necessary background for creating the projects outlined in this book.




Free download pdf