PHP
  Home arrow PHP arrow Handling Views with CodeIgniter
Dev Shed Forums  
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
VPS Hosting  
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid  
Request Media Kit
Contact Us  
Site Map  
Privacy Policy  
Support  
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Handling Views with CodeIgniter
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 6
    2009-03-19


    Table of Contents:
  • Handling Views with CodeIgniter
  • Preparing views to be rendered on screen
  • Creating a content view
  • Building a web page controller class

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article

     
     
    ADVERTISEMENT


    Handling Views with CodeIgniter
    ( Page 1 of 4 )

    The Code Igniter framework makes it easy for developers to implement a Model-View-Controller design pattern in PHP. This concept can be difficult for newcomers to grasp, so this seven-part series of articles will focus on one aspect of it: views, and the many clever ways you can handle them with Code Igniter. Welcome to the first part.

    Introduction

    Any PHP developer who has spent a few weeks working with the CodeIgniter framework quickly discovers its many virtues. It has a relatively flat learning curve, and clear, thorough online documentation. Moreover, it lets users  implement the Model-View-Controller design pattern in a fairly strict fashion, and its flexible structure allows the extension of its core functionality via custom libraries, helpers and plug-ins.

    Naturally, for seasoned CodeIgniter users, it's a straightforward process to put all of these features to work together. For newcomers though, things tend to be more complicated, particularly when it comes to taking certain theoretical concepts inherent in the MVC schema and putting them into practice.

    As soon as an inexperienced user starts developing a simple web application with CodeIgniter, he/she will be confronted with a number of common questions regarding the proper implementation and usage of Models, Controllers and Views. While learning how to work with Models and Controllers can be a challenging task, at least at first, the truth is that generating views seems to be much more approachable.

    To clarify this concept a bit further, say that you’re building a web site comprised of a header section, a main area populated with some database contents, and finally a footer. In a case like this, the approach to be followed is pretty simple: on one hand you’d define a model that performs a few CRUD operations on your database, while on the other hand, there would be a controller that uses the model’s methods to fetch database rows, which would finally be embedded into some views to generate the different sections of the site.

    In reality, implementing this view-centric method is actually pretty easy to achieve. However, CodeIgniter provides web developers with enough flexibility to handle views in all sort of clever ways. Therefore, in this series of articles I’ll be discussing in detail some common approaches that you can use to generate views, ranging from loading them sequentially, to using more complex methods, such as including views within other views.

    Are you ready to learn how to handle views with CodeIgniter? Then let’s begin right now!



     
     
    >>> More PHP Articles          >>> More By Alejandro Gervasio
     

       

    PHP ARTICLES

    - Building Dynamic Queries with Chainable Meth...
    - PHP Encryption and Decryption Methods
    - Building a MySQL Abstraction Class with Meth...
    - Completing a Sample String Processor with Me...
    - Mastering WHILE Loops for PHP and MySQL
    - Method Chaining: Adding More Methods to the ...
    - Method Chaining in PHP 5
    - The Role of Interfaces in Applying the Depen...
    - Dependency Injection: Using a Setter Method ...
    - Using a Model Class with the Dependency Inje...
    - Injecting Objects Using Setter Methods with ...
    - Injecting Objects by Constructor with the De...
    - The Dependency Injection Design Pattern in P...
    - Performing Inferential Statistical Analysis ...
    - Performing Descriptive Statistical Analysis ...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    Stay green...Green IT