PHP
  Home arrow PHP arrow Returning Strings from Views with Code Igniter
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? 
Google.com  
PHP

Returning Strings from Views with Code Igniter
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 1
    2009-04-09


    Table of Contents:
  • Returning Strings from Views with Code Igniter
  • Review: using nested views along with the load-vars() method
  • Generating partial sections of a web page
  • Putting all of the views together

  • 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


    Returning Strings from Views with Code Igniter
    (Page 1 of 4 )

    When it comes to generating both static and dynamic web pages, CodeIgniter gives PHP developers the liberty of working with different approaches that can be easily adapted to suit the requirements of a huge variety of web applications. Building web pages using CI demands that you always deal with one or multiple views, generally represented in the form of HTML files that contain embedded PHP variables. Therefore, if you’re a CI user who want to learn to manipulate views in some clever ways, keep reading. In this series of articles, you’ll find a comprehensive guide to several methods you can implement within your own CI-based applications to handle view files in a truly efficient manner.

    Introduction

    Now that you know what to expect from this article series, it’s time to recapitulate briefly the topics that were discussed in the last installment. In that particular tutorial I demonstrated how to build a simple MySQL-driven application by using a combination of the “$this->load->vars()” method and nested views.

    This approach allowed me to generate independently different sections of a front page, whose main area was populated with data fetched from a sample “users” MySQL table. Admittedly, including views within other views is a useful method that permits you to use certain parts of a web document across multiple pages of a web site; but the most interesting aspect of it is that it can be implemented in different ways.

    Speaking more specifically, it’s possible to feed the “$this->load->view()” method of CI a third Boolean parameter, to return the contents of a view to calling code after the view has been parsed. This is a handy variation of the method demonstrated in the previous article, and in this tutorial I’ll be taking a close look at it, so you can grasp its underlying logic.

    Now, it’s time to get things rolling on and see how to return strings from views with CodeIgniter. Let’s do it!



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

       

    PHP ARTICLES

    - Implementing the Iterator SPL Interface
    - Building a Data Access Layer for the Data Ma...
    - Building a Singleton Database with Restricti...
    - Working with Reflected Properties with the R...
    - The Iterator, Countable and ArrayAccess SPL ...
    - Implementing the Data Mapper Design Pattern ...
    - Defining an Abstract Class with Restrictive ...
    - The Reflection API: Working with Reflected M...
    - Using Restrictive Constructors in PHP 5
    - Getting Information on a Reflected Class wit...
    - Introducing the Reflection API in PHP 5
    - Swift Mailer's Batchsend Method and Other Fe...
    - Embedding Attachments into Email Messages wi...
    - Dynamically Attaching Files with Swift Mailer
    - Using Different Paths for Attachments with S...


    Code Analysis Tools
    Enterprise code analysis tools that deliver quality and reliable code

     



    © 2003-2010 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek