Home arrow PHP arrow Returning Strings from Views with Code Igniter

Returning Strings from Views with Code Igniter

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.

  1. Returning Strings from Views with Code Igniter
  2. Review: using nested views along with the load-vars() method
  3. Generating partial sections of a web page
  4. Putting all of the views together
By: Alejandro Gervasio
Rating: starstarstarstarstar / 6
April 09, 2009

print this article




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

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates


Dev Shed Tutorial Topics: