Home arrow PHP arrow Page 3 - Working with the Email Class in Code Igniter

Defining a simple view file - PHP

Unless youíve already built a PHP toolkit that lets you develop web applications by reusing its components, the best way to create complex PHP programs quickly is by means of a third-party framework, such as Code Igniter (http://codegniter.com). This package will let you build robust object-based PHP applications in literally minutes, thanks to its extremely friendly interface. So, if youíre interested in learning how to put this framework to work for you, start reading this article now!

  1. Working with the Email Class in Code Igniter
  2. Sending email with Code Igniter
  3. Defining a simple view file
  4. Sending email messages via an HTML form
By: Alejandro Gervasio
Rating: starstarstarstarstar / 7
October 01, 2008

print this article



In the section that you just read, I showed you how to build a basic controller class, which was provided with the capacity to send email messages in a simple fashion. Nonetheless, we need to construct the important part of the program that indicates to the user whether or not the message has been successfully dispatched.

To perform this task, Iím going to create a primitive view file, whose signature will look as simple as this:



<title><?php echo $title;?></title>



<h1><?php echo $header;?></h1>

<p><?php echo $message;?></p>



Undoubtedly, the structure of the view file shown above is extremely simplistic. As you can see, this view, aside from displaying the title along with a simple header, will show an additional message on screen which indicates that the email message has been successfully submitted, or in the worst case, that it failed to be dispatched.

It would also be possible to create two different views, where each of them would be used by the previous controller to display en error string or a confirmation message. However, in this case I decided to code only one view file to keep the example rather simple to follow.

So far, so good. At this point I've demonstrated how to use Code Igniter to develop a simple email application, whose structure has been built around the schema imposed by the MVC pattern. So, what comes next?

In the following section Iím going to explain how to take advantage once again of the email class that comes included with Code Igniter. In this case, we'll build a PHP program that sends email using the data entered in a simple HTML form.

To learn how this sample email application will be developed, youíll have to click on the link shown below and keep reading.

>>> 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: