<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    xmlns:admin="http://webns.net/mvcb/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:content="http://purl.org/rss/1.0/modules/content/">

    <channel>
    
    <title>CI News</title>
    <link>http://codeigniter.com/news/</link>
    <description></description>
    <dc:language>en</dc:language>
    <dc:creator>derek.jones@ellislab.com</dc:creator>
    <dc:rights>Copyright 2010</dc:rights>
    <dc:date>2010-02-04T16:28:45-06:00</dc:date>
    <admin:generatorAgent rdf:resource="http://expressionengine.com/" />
    

    <item>
      <title>Subversion Server Change</title>
      <link>http://codeigniter.com/news/subversion_server_change/</link>
      <guid>http://codeigniter.com/news/subversion_server_change/#When:16:28:45Z</guid>
      <description><![CDATA[<p>Our Subversion repositories have moved.&nbsp; Please update your repositories or check out new ones from the new location: <a href="http://svn.ellislab.com/CodeIgniter/trunk">http://svn.ellislab.com/CodeIgniter/trunk</a></p>

<p>As always, information about our Subversion repositories can be found on the <a href="http://codeigniter.com/downloads/">download page</a> and <a href="http://codeigniter.com/user_guide/installation/downloads.html">installation instructions</a>.
</p>]]></description>
      <dc:subject></dc:subject>
      <dc:date>2010-02-04T16:28:45-06:00</dc:date>
    </item>

    <item>
      <title>CodeIgniter Community Chieftain Jamie Rumbelow</title>
      <link>http://codeigniter.com/news/codeigniter_community_chieftain_jamie_rumbelow/</link>
      <guid>http://codeigniter.com/news/codeigniter_community_chieftain_jamie_rumbelow/#When:18:49:44Z</guid>
      <description><![CDATA[<p>We&#8217;re happy to announce the next <a href="http://codeigniter.com/forums/viewannounce/85513_49/">CodeIgniter Community Chieftain</a>, <a href="http://codeigniter.com/forums/member/60793/">Jamie Rumbelow</a>!&nbsp; This invitation only volunteer program focuses on identifying stellar examples from the community, and letting them utilize their strengths to help maintain the community and act as a liaison when needed to EllisLab.</p>

<p>Jamie will be taking the reigns from our first Community Chieftain, Michael Wales.&nbsp; Thanks Mike for your year and a half of volunteer service, and welcome aboard, Jamie!
</p>]]></description>
      <dc:subject></dc:subject>
      <dc:date>2009-12-06T18:49:44-06:00</dc:date>
    </item>

    <item>
      <title>CodeIgniter v1.7.2 Released</title>
      <link>http://codeigniter.com/news/codeigniter_v1.7.2_released/</link>
      <guid>http://codeigniter.com/news/codeigniter_v1.7.2_released/#When:15:03:11Z</guid>
      <description><![CDATA[<p>EllisLab is pleased to release CodeIgniter version 1.7.2 for ready download.&nbsp; What&#8217;s new?&nbsp; Among other <a href="http://codeigniter.com/user_guide/changelog.html">changes</a>:</p>

<ul>
<li>Compatible with PHP 5.3.0</li>
<li>Added a new <a href="http://codeigniter.com/user_guide/libraries/cart.html">Cart Class</a>.</li>
<li>Improvements to the <a href="http://codeigniter.com/user_guide/helpers/form_helper.html">Form helper</a></li>
<li>Added is_php() to <a href="http://codeigniter.com/user_guide/general/common_functions.html">Common functions</a> to facilitate PHP version comparisons</li>
<li>Modified <a href="http://codeigniter.com/user_guide/general/errors.html">show_error()</a> to allow sending of HTTP server response codes, and all internal uses now send proper status codes.</li>
<li>Numerous bug fixes</li>
</ul>

<p>Version 1.7.2 has been baking in the subversion for quite some time, and has been compatible with PHP 5.3.0 since late July, but many users understandably haven&#8217;t been running from the in-development version.&nbsp; While I&#8217;d have liked to have had time to add a few more &#8220;big ticket&#8221; items to this release, making it 1.8, time is a cruel mistress.&nbsp; Many of our users develop on Macs, and OS X Snow Leopard ships with PHP 5.3.0, so we felt is was more important to push out this stable maintenance release instead of waiting for an even later date - it&#8217;s been almost seven months since a refresh, afterall.&nbsp; But there are still a few good surprises, and welcome changes.&nbsp; <a href="http://codeigniter.com/downloads/">Enjoy!</a>
</p>]]></description>
      <dc:subject></dc:subject>
      <dc:date>2009-09-11T15:03:11-06:00</dc:date>
    </item>

    <item>
      <title>CodeIgniter 1.7.1 Released</title>
      <link>http://codeigniter.com/news/codeigniter_1.7.1_released/</link>
      <guid>http://codeigniter.com/news/codeigniter_1.7.1_released/#When:01:24:04Z</guid>
      <description><![CDATA[<p>CodeIgniter Version 1.7.1 has been released.&nbsp; This version contains many new features and enhancements, as well as nearly three dozen bug fixes. It also includes a critical security update for applications using the new Form Validation library with field arrays.&nbsp; For a list of all changes please see the <a href="http://www.codeigniter.com/user_guide/changelog.html">Change Log</a>.</p>

<p>If you are currently running CodeIgniter please read the <a href="http://www.codeigniter.com/user_guide/installation/upgrading.html">update instructions</a>.</p>

<p>Note:&nbsp; If your browser does not display the 1.7.1 user guide please clear your cache and reload the page.
</p>]]></description>
      <dc:subject></dc:subject>
      <dc:date>2009-02-11T01:24:04-06:00</dc:date>
    </item>

    <item>
      <title>CodeIgniter 1.7.0 Released</title>
      <link>http://codeigniter.com/news/codeigniter_170_released/</link>
      <guid>http://codeigniter.com/news/codeigniter_170_released/#When:23:48:11Z</guid>
      <description><![CDATA[<p>CodeIgniter Version 1.7 has been released.&nbsp; This version contains a number of new features and enhancements, as well as many small improvements and bug fixes. For a list of all changes please see the <a href="http://www.codeigniter.com/user_guide/changelog.html">Change Log</a>.</p>

<p>If you are currently running CodeIgniter please read the <a href="http://www.codeigniter.com/user_guide/installation/upgrading.html">update instructions</a>.</p>

<p>Note:&nbsp; If your browser does not display the 1.7 user guide please clear your cache and reload the page.
</p>]]></description>
      <dc:subject></dc:subject>
      <dc:date>2008-10-23T23:48:11-06:00</dc:date>
    </item>

    <item>
      <title>CodeIgniter Community Voice &#45; HOWTO: Set up a CodeIgniter project in Subversion</title>
      <link>http://codeigniter.com/news/codeigniter_community_voice_howto_set_up_a_codeigniter_project_in_subversio/</link>
      <guid>http://codeigniter.com/news/codeigniter_community_voice_howto_set_up_a_codeigniter_project_in_subversio/#When:11:49:00Z</guid>
      <description><![CDATA[<p>EllisLab is blessed with two of the greatest communities that can be found anywhere on the internet in ExpressionEngine and more recently CodeIgniter.&nbsp; Despite being a relative newcomer to the scene, the people attracted to CodeIgniter are among the smartest, most talented and down-to-earth developers around today.&nbsp; From time to time we want to highlight some of these talented people, and we&#8217;ve asked them to lend their voice to ours.&nbsp;  <em><a href="http://codeigniter.com/forums/viewannounce/81650_49/">Have your voice</a></em>.&nbsp; I hope you enjoy what they have to say as much as I did.</p>

<p>This week, our Community Voice author is Bruce Alderson, known on the forums as <a href="http://codeigniter.com/forums/member/65974/">madmaxx</a>, who has written a wonderful guide on how he uses subversion with CodeIgniter.&nbsp; Bruce is an elder web monkey and systems programmer.&nbsp; He totally digs the craft of building software, making cool stuff, and causing people to laugh so hard liquids are forced from their nose.&nbsp; He&#8217;s currently the Chief Monkey at Discovery Software and author of the not-at-all famous <a href="http://robotpony.ca">robotpony.ca</a>.&nbsp; (Go read the one about <a href="http://robotpony.ca/page/29/">shaving your yak</a>)</p>

<hr />

<p>After working with <a href="http://codeigniter.com">CodeIgniter</a> for a few months (and WordPress for a few years), I’ve settled on a way to set up web projects that works well for development, deployment, and source control. Note that this style of layout only works on systems like Mac and Linux that have useful symlinks.</p>

<h4>First, the folder layout</h4>
<div class="codeblock"><code><span style="color: #000000">
<span style="color: #0000BB">some</span><span style="color: #007700">-</span><span style="color: #0000BB">domain</span><span style="color: #007700">.</span><span style="color: #0000BB">com</span><span style="color: #007700">/<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">app</span><span style="color: #007700">/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">config</span><span style="color: #007700">/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">controllers</span><span style="color: #007700">/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(</span><span style="color: #0000BB">etc</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">public</span><span style="color: #007700">/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.</span><span style="color: #0000BB">htaccess&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">-&gt; ../</span><span style="color: #0000BB">site</span><span style="color: #007700">-</span><span style="color: #0000BB">extras</span><span style="color: #007700">/.</span><span style="color: #0000BB">htaccess<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;favicon</span><span style="color: #007700">.</span><span style="color: #0000BB">ico&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">-&gt; ../</span><span style="color: #0000BB">site</span><span style="color: #007700">-</span><span style="color: #0000BB">extras</span><span style="color: #007700">/</span><span style="color: #0000BB">favicon</span><span style="color: #007700">.</span><span style="color: #0000BB">ico<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;js</span><span style="color: #007700">/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&gt; ../</span><span style="color: #0000BB">site</span><span style="color: #007700">-</span><span style="color: #0000BB">extras</span><span style="color: #007700">/</span><span style="color: #0000BB">js<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;images</span><span style="color: #007700">/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&gt; ../</span><span style="color: #0000BB">site</span><span style="color: #007700">-</span><span style="color: #0000BB">extras</span><span style="color: #007700">/</span><span style="color: #0000BB">images<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;system</span><span style="color: #007700">/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">application</span><span style="color: #007700">/&nbsp;&nbsp;&nbsp;&nbsp;-&gt; ../../</span><span style="color: #0000BB">app</span><span style="color: #007700">/<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">site</span><span style="color: #007700">-</span><span style="color: #0000BB">extras</span><span style="color: #007700">/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">js</span><span style="color: #007700">/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">images</span><span style="color: #007700">/<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.</span><span style="color: #0000BB">htaccess </span>
</span>
</code></div>

<p>The layout favours a <a href="http://en.wikipedia.org/wiki/Vhost">vhost</a> setup, and splits your code and resources out of the CodeIgniter sources. Splitting your stuff from the CodeIgniter stuff lets you link your Subversion repository to theirs, so that you can keep it in sync with their development.</p>

<h4>How it&#8217;s done</h4>

<ol><li>Set up your source tree (not including the symlinks or CodeIgniter source) and add to your Subversion repo.</li><li>Add a <kbd>svn</kbd> link to CodeIgniter&#8217;s repo (via <kbd>svn propedit svn:externals</kbd>, with <kbd>public  <a href="http://dev.ellislab.com/svn/CodeIgniter/tags/v1.6.2/">http://dev.ellislab.com/svn/CodeIgniter/tags/v1.6.2/</a></kbd>) and run a <kbd>svn update</kbd> to grab the framework.&nbsp; See the <a href="http://svnbook.red-bean.com/en/1.0/ch07s03.html">Subversion docs</a> for details.</li><li>Copy the CI <kbd>application</kbd> folder to the site root (as <kbd>app</kbd>), remove the <kbd>.svn</kbd> folders, symlink to <kbd>application</kbd>, and add it to your local svn repo.</li><li>Symlink the other site-extras to the <kbd>public</kbd> webserver root, and configure your local machine (and public webserver) to point to this root for the domain&#8217;s virtual host setup.</li><li>Alternatively, you can modify the <kbd>$application_path</kbd> to point to <kbd>../public/app/</kbd> (I&#8217;m not sure which is better yet).&nbsp; See the <a href="http://codeigniter.com/user_guide/general/managing_apps.html">CodeIgniter docs on apps</a> for more details.</li></ol>

<p>You now have a CodeIgnitor project ready for development. You can keep up-to-date with CodeIgniter updates, deploy easily, and get at your code without wading through extra levels of hierarchy.</p>

<p><br />
<a href="http://codeigniter.com/forums/viewthread/88290/">Discuss this article</a>
</p>]]></description>
      <dc:subject>Community Voice</dc:subject>
      <dc:date>2008-08-15T11:49:00-06:00</dc:date>
    </item>

    <item>
      <title>CodeIgniter Community Voice &#45; Generating PDF files using CodeIgniter</title>
      <link>http://codeigniter.com/news/codeigniter_community_voice_generating_pdf_files_using_codeigniter/</link>
      <guid>http://codeigniter.com/news/codeigniter_community_voice_generating_pdf_files_using_codeigniter/#When:16:33:01Z</guid>
      <description><![CDATA[<p>EllisLab is blessed with two of the greatest communities that can be found anywhere on the internet in ExpressionEngine and more recently CodeIgniter.&nbsp; Despite being a relative newcomer to the scene, the people attracted to CodeIgniter are among the smartest, most talented and down-to-earth developers around today.&nbsp; From time to time we want to highlight some of these talented people, and we&#8217;ve asked them to lend their voice to ours.&nbsp;  <em><a href="http://codeigniter.com/forums/viewannounce/81650_49/">Have your voice</a></em>.&nbsp; I hope you enjoy what they have to say as much as I did.</p>

<p>This week, our Community Voice author is Chris Monnat, known on the forums as <a href="http://codeigniter.com/forums/member/34172/">mrtopher</a>, who writes a helpful step by step guide to generating PDF files from CodeIgniter.&nbsp; Chris is a full time web application developer and part time entrepreneur. In addition to building web sites for the medical industry during the day, at night Chris also runs his own development company <a href="http://www.leftofcentercom.com">Left of Center Communications</a>. He recently started a personal blog at <a href="http://www.chrismonnat.com">http://www.chrismonnat.com</a> where he keeps a record of his exploits and discusses, among other things, CodeIgniter.</p>

<hr />

<p>PDF files rock! Some of the programs used to view them could use some work, but the file format itself is real handy. As a programmer I have found PDF&#8217;s to be most helpful when generating reports that need to be printable. I know we are all supposed to be doing our part to make our offices &#8220;greener&#8221; and use less resources like paper. But some things just need to be printed (especially when your talking about the financial and legal industries).</p>

<p>When generating reports in PDF format you suddenly have a lot more control over layout and design than  you do with plain old HTML and CSS (although much progress is being made with print style sheets). You can create some really nice reports on the fly that your users can view, save for later or e-mail to their co-workers for review. In this post I will show you how I generate PDF reports using <a href="http://codeigniter.com">CodeIgniter</a>.</p>

<h4>Quick Note</h4>

<p>There are a number of PHP libraries out there for generating PDF files (like <a href="http://www.fpdf.org/">FPDF</a>, <a href="http://www.stillhq.com/opensource.html">Panda</a> and <a href="http://www.digitaljunkies.ca/dompdf/">dompdf</a>) but the best one I have come across is the <a href="http://www.ros.co.nz/pdf/">R&amp;OS pdf class</a>. I was first introduced to it from the <a href="http://www.sitepoint.com/books/phpant1/?SID=beb1c45753ae71830305e53194bf4faf">PHP Anthology</a> first edition by Harry Fuecks. I have tried other PDF libraries (some PHP 5 specific and some not) and none of them have been able to provide me with the same control or ease of use that the R&amp;OS class has which is why I&#8217;m using it for this tutorial.</p>

<h4>Getting Started</h4>

<p>Before we start, lets get everyone to the same place so you can follow along as we go. I&#8217;ve prepared a .zip file containing everything you&#8217;ll need to follow along. The archive includes CI 1.6.3 along with all the code and libraries we will discuss in this tutorial. Simply <a href="http://codeigniter.com/files/ci_blog/pdf_tutorial.zip">download the archive</a>, unzip it on your web server and follow along.</p>

<p>I have done all the work of downloading the code library and putting the files in their right place for you, but I wanted to mention where things were for the detail oriented among you. There are 2 files that are necessary in order to use the R&amp;OS library: <strong>class.ezpdf.php</strong> and <strong>class.pdf.php</strong>. Those two files have been placed in the application/library folder. R&amp;OS also requires some font files in order to function and they have been placed at the root of the .zip file in a folder called <strong>fonts</strong>.</p>

<p>You do have to make a minor modification to the <strong>class.ezpdf.php</strong> file so that it will work properly within CI. First I renamed the file to <strong>cezpdf.php</strong>, which makes it easier to load using the CI loader. Then you have to modify the include statement on line 3 to:</p>

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #007700">include_once(</span><span style="color: #0000BB">APPPATH </span><span style="color: #007700">. </span><span style="color: #DD0000">'libraries/class.pdf.php'</span><span style="color: #007700">); </span>
</span>
</code></div>

<p>This will keep PHP from saying that it can&#8217;t find included file. Once those modifications are made the R&amp;OS class is ready to use with CI.

<p>In the archive, I have also made a controller called<strong> tutorial.php</strong> and a helper called <strong>pdf_helper</strong>.<strong>php</strong> both in their respective directories. With the background info. out of the way, lets get our hands dirty with a real simple example.
<h4>Hello World</h4>
<div class="codeblock"><code><span style="color: #000000">
<span style="color: #007700">function </span><span style="color: #0000BB">hello_world</span><span style="color: #007700">()<br /></span><span style="color: #0000BB">&#123;<br />$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">load</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">library</span><span style="color: #007700">(</span><span style="color: #DD0000">'cezpdf'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cezpdf</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">ezText</span><span style="color: #007700">(</span><span style="color: #DD0000">'Hello World'</span><span style="color: #007700">, </span><span style="color: #0000BB">12</span><span style="color: #007700">, array(</span><span style="color: #DD0000">'justification' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'center'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cezpdf</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">ezSetDy</span><span style="color: #007700">(-</span><span style="color: #0000BB">10</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$content </span><span style="color: #007700">= </span><span style="color: #DD0000">'The quick, brown fox jumps over a lazy dog. DJs flock by when MTV ax quiz prog.<br />Junk MTV quiz graced by fox whelps. Bawds jog, flick quartz, vex nymphs.'</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cezpdf</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">ezText</span><span style="color: #007700">(</span><span style="color: #0000BB">$content</span><span style="color: #007700">, </span><span style="color: #0000BB">10</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cezpdf</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">ezStream</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">&#125; </span>
</span>
</code></div>

The above code produces a PDF file <a href="http://codeigniter.com/files/ci_blog/hello_world.pdf">like this</a>.

In the above, first thing we do is load the R&amp;OS library for use. Next we use the <strong>ezText()</strong> function to create a title for our document. This function takes the text it will display as the first argument, the size of that text and an optional array of additional configuration options. In this instance we pass along a justification option of center. That will center our title at the top of our document.

After the title we insert some extra white space using the <strong>ezSetDy()</strong> function. After the whites pace we put the rest of the content for the document in a variable called $content and add it to our document using the <strong>ezText()</strong> function again. Finally, we create our document using the <strong>ezStream()</strong> function which actually creates the document and sends it to the users which prompts them to view/download the generated PDF document.

<h4>Handling Tabular Data</h4>

When your dealing with business reports the odds are good that you will need to generate reports with tables to display tabular data. From my experience with other PDF libraries, this is not an easy task. But with the R&amp;OS library it&#8217;s about as hard as creating an array.

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #007700">function </span><span style="color: #0000BB">tables</span><span style="color: #007700">()<br /></span><span style="color: #0000BB">&#123;<br />$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">load</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">library</span><span style="color: #007700">(</span><span style="color: #DD0000">'cezpdf'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$db_data&#91;&#93; </span><span style="color: #007700">= array(</span><span style="color: #DD0000">'name' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Jon Doe'</span><span style="color: #007700">, </span><span style="color: #DD0000">'phone' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'111-222-3333'</span><span style="color: #007700">, </span><span style="color: #DD0000">'email' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'jdoe@someplace.com'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$db_data&#91;&#93; </span><span style="color: #007700">= array(</span><span style="color: #DD0000">'name' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Jane Doe'</span><span style="color: #007700">, </span><span style="color: #DD0000">'phone' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'222-333-4444'</span><span style="color: #007700">, </span><span style="color: #DD0000">'email' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'jane.doe@something.com'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$db_data&#91;&#93; </span><span style="color: #007700">= array(</span><span style="color: #DD0000">'name' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Jon Smith'</span><span style="color: #007700">, </span><span style="color: #DD0000">'phone' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'333-444-5555'</span><span style="color: #007700">, </span><span style="color: #DD0000">'email' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'jsmith@someplacepsecial.com'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$col_names </span><span style="color: #007700">= array(<br /></span><span style="color: #DD0000">'name' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Name'</span><span style="color: #007700">,<br /></span><span style="color: #DD0000">'phone' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'Phone Number'</span><span style="color: #007700">,<br /></span><span style="color: #DD0000">'email' </span><span style="color: #007700">=&gt; </span><span style="color: #DD0000">'E-mail Address'<br /></span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cezpdf</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">ezTable</span><span style="color: #007700">(</span><span style="color: #0000BB">$table_data</span><span style="color: #007700">, </span><span style="color: #0000BB">$col_names</span><span style="color: #007700">, </span><span style="color: #DD0000">'Contact List'</span><span style="color: #007700">, array(</span><span style="color: #DD0000">'width'</span><span style="color: #007700">=&gt;</span><span style="color: #0000BB">550</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$this</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cezpdf</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">ezStream</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">&#125; </span>
</span>
</code></div>

The above code should produce a PDF file <a href="http://codeigniter.com/files/ci_blog/tables.pdf">like this</a>.

In the above code I create an array of data called $db_data. I put this together so that it imitates a typical database result set because that&#8217;s usually where you will be getting your data from. Below my data array I have created a $col_names array that associates the data elements in the $db_data array with a column title for the table. This is where the R&amp;OS gets the title to display at the top of each table column. Once I have the data and column titles I create the table by calling the <strong>ezTable()</strong> function. This function takes the data array, an associative array for column names, the title for the table and an optional array of configuration options. There are a number of options that can be configured through that last optional array, but I&#8217;m not going to go into them in this tutorial.

<h4>Headers and Footers</h4>

Most reports in a corporate setting come with some kind of standard header and/or footer. They can include anything from the date/time generated, the user who generated them, to page numbers and the like. Headers and footers are handy to have, but unfortunately there isn&#8217;t a real good way to add them to printable reports generated in HTML and CSS. There&#8217;s one more reason to use the portable document format when creating printable reports.

The process of adding headers and footers to a PDF using the R&amp;OS library is the slightest bit complicated. There are a lot of lines of code just to accomplish it, that&#8217;s why I have created a helper file. Since the code is in a helper function, you just need load the helper and call the function whenever you need to add headers/footers to a PDF.

<div class="codeblock"><code><span style="color: #000000">
<span style="color: #007700">function </span><span style="color: #0000BB">prep_pdf</span><span style="color: #007700">(</span><span style="color: #0000BB">$orientation </span><span style="color: #007700">= </span><span style="color: #DD0000">'portrait'</span><span style="color: #007700">)<br /></span><span style="color: #0000BB">&#123;<br />$CI </span><span style="color: #007700">= &amp;</span><span style="color: #0000BB">amp</span><span style="color: #007700">; </span><span style="color: #0000BB">get_instance</span><span style="color: #007700">();<br /><br /></span><span style="color: #0000BB">$CI</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cezpdf</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">selectFont</span><span style="color: #007700">(</span><span style="color: #0000BB">base_url</span><span style="color: #007700">() . </span><span style="color: #DD0000">'/fonts'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$all </span><span style="color: #007700">= </span><span style="color: #0000BB">$CI</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cezpdf</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">openObject</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$CI</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cezpdf</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">saveState</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$CI</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cezpdf</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setStrokeColor</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">,</span><span style="color: #0000BB">0</span><span style="color: #007700">,</span><span style="color: #0000BB">0</span><span style="color: #007700">,</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br />if(</span><span style="color: #0000BB">$orientation </span><span style="color: #007700">== </span><span style="color: #DD0000">'portrait'</span><span style="color: #007700">) </span><span style="color: #0000BB">&#123;<br />$CI</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cezpdf</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">ezSetMargins</span><span style="color: #007700">(</span><span style="color: #0000BB">50</span><span style="color: #007700">,</span><span style="color: #0000BB">70</span><span style="color: #007700">,</span><span style="color: #0000BB">50</span><span style="color: #007700">,</span><span style="color: #0000BB">50</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$CI</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cezpdf</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">ezStartPageNumbers</span><span style="color: #007700">(</span><span style="color: #0000BB">500</span><span style="color: #007700">,</span><span style="color: #0000BB">28</span><span style="color: #007700">,</span><span style="color: #0000BB">8</span><span style="color: #007700">,</span><span style="color: #DD0000">''</span><span style="color: #007700">,</span><span style="color: #DD0000">'&#123;PAGENUM&#125;'</span><span style="color: #007700">,</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$CI</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cezpdf</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">line</span><span style="color: #007700">(</span><span style="color: #0000BB">20</span><span style="color: #007700">,</span><span style="color: #0000BB">40</span><span style="color: #007700">,</span><span style="color: #0000BB">578</span><span style="color: #007700">,</span><span style="color: #0000BB">40</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$CI</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cezpdf</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addText</span><span style="color: #007700">(</span><span style="color: #0000BB">50</span><span style="color: #007700">,</span><span style="color: #0000BB">32</span><span style="color: #007700">,</span><span style="color: #0000BB">8</span><span style="color: #007700">,</span><span style="color: #DD0000">'Printed on ' </span><span style="color: #007700">. </span><span style="color: #0000BB">date</span><span style="color: #007700">(</span><span style="color: #DD0000">'m/d/Y h:i:s a'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$CI</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cezpdf</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addText</span><span style="color: #007700">(</span><span style="color: #0000BB">50</span><span style="color: #007700">,</span><span style="color: #0000BB">22</span><span style="color: #007700">,</span><span style="color: #0000BB">8</span><span style="color: #007700">,</span><span style="color: #DD0000">'CI PDF Tutorial - http://www.christophermonnat.com'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">&#125;<br /></span><span style="color: #007700">else </span><span style="color: #0000BB">&#123;<br />$CI</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cezpdf</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">ezStartPageNumbers</span><span style="color: #007700">(</span><span style="color: #0000BB">750</span><span style="color: #007700">,</span><span style="color: #0000BB">28</span><span style="color: #007700">,</span><span style="color: #0000BB">8</span><span style="color: #007700">,</span><span style="color: #DD0000">''</span><span style="color: #007700">,</span><span style="color: #DD0000">'&#123;PAGENUM&#125;'</span><span style="color: #007700">,</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$CI</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cezpdf</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">line</span><span style="color: #007700">(</span><span style="color: #0000BB">20</span><span style="color: #007700">,</span><span style="color: #0000BB">40</span><span style="color: #007700">,</span><span style="color: #0000BB">800</span><span style="color: #007700">,</span><span style="color: #0000BB">40</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$CI</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cezpdf</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addText</span><span style="color: #007700">(</span><span style="color: #0000BB">50</span><span style="color: #007700">,</span><span style="color: #0000BB">32</span><span style="color: #007700">,</span><span style="color: #0000BB">8</span><span style="color: #007700">,</span><span style="color: #DD0000">'Printed on '</span><span style="color: #007700">.</span><span style="color: #0000BB">date</span><span style="color: #007700">(</span><span style="color: #DD0000">'m/d/Y h:i:s a'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$CI</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cezpdf</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addText</span><span style="color: #007700">(</span><span style="color: #0000BB">50</span><span style="color: #007700">,</span><span style="color: #0000BB">22</span><span style="color: #007700">,</span><span style="color: #0000BB">8</span><span style="color: #007700">,</span><span style="color: #DD0000">'CI PDF Tutorial - http://www.christophermonnat.com'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">&#125;<br />$CI</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cezpdf</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">restoreState</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$CI</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cezpdf</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">closeObject</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$CI</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">cezpdf</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addObject</span><span style="color: #007700">(</span><span style="color: #0000BB">$all</span><span style="color: #007700">,</span><span style="color: #DD0000">'all'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">&#125; </span>
</span>
</code></div>

An example of how I use this helper is provided in the headers() function of the tutorial.php controller. That code produces a PDF file <a href="http://codeigniter.com/files/ci_blog/headers.pdf">like this</a>.

The above code is the <strong>prep_pdf()</strong> function located in the <strong>pdf_helper.php</strong> file. This function does all the hard work of creating a footer for my PDF reports for me. All I have to do is load the helper in my controller and call the function. Since the reports could be portrait or landscape I have also included the ability to pass the orientation to the function and the code will modify the document margins accordingly.

I&#8217;m not going to go into a lot of detail about the above code because this tutorial could become very long. But the general idea is that I&#8217;m using the R&amp;OS library to modify the margins of the document I&#8217;m creating, add page numbers and text to the very bottom of the document. R&amp;OS has some functions that makes this easy like <strong>ezStartPageNumbers()</strong> and <strong>line()</strong>. Once all that is done I can add any kind of content to the document back in my controller and then just call <strong>ezStream()</strong> to generate the final document.

<h4>Wrap Up</h4>

I barely scratched the surface of what you can do with the R&amp;OS PDF library in this tutorial. I encourage you to spend some quality time with the <strong>readme.pdf</strong> documentation file that comes with the library when you download it. That file goes over all the functions and their options in great detail.

So there you have it, generating PDF files with CodeIgniter and the R&amp;OS library. If this method doesn&#8217;t quite do it for you, there are a few helpful articles on the CodeIgniter <a href="http://codeigniter.com/wiki/">wiki</a>, like <a href="http://codeigniter.com/wiki/PDF_generation_using_dom/">this one</a> and <a href="http://codeigniter.com/wiki/fpdf_CIed/">this one</a>, which walk you through some additional options. Whatever solution you choose I hope this tutorial has helped to introduce you to some of the options you have at your disposal for creating PDF reports with CodeIgniter.

<a href="http://codeigniter.com/forums/viewthread/86890/">Discuss this article</a>]]></description>
      <dc:subject>Community Voice</dc:subject>
      <dc:date>2008-07-31T16:33:01-06:00</dc:date>
    </item>

    <item>
      <title>CodeIgniter Community Voice &#45; Lee&#8217;s Lost Bet</title>
      <link>http://codeigniter.com/news/codeigniter_community_voice_lees_lost_bet/</link>
      <guid>http://codeigniter.com/news/codeigniter_community_voice_lees_lost_bet/#When:20:33:00Z</guid>
      <description><![CDATA[<p>EllisLab is blessed with two of the greatest communities that can be found anywhere on the internet in ExpressionEngine and more recently CodeIgniter.&nbsp; Despite being a relative newcomer to the scene, the people attracted to CodeIgniter are among the smartest, most talented and down-to-earth developers around today.&nbsp; From time to time we want to highlight some of these talented people, and we&#8217;ve asked them to lend their voice to ours.&nbsp;  <em><a href="http://codeigniter.com/forums/viewannounce/81650_49/">Have your voice</a></em>.&nbsp; I hope you enjoy what they have to say as much as I did.</p>

<p>This week, our Community Voice author is Lee Tengum, who discusses how CodeIgniter has cost him over $8,800 in beer and soft drinks. Lee is a bit of a serial entrepreneur, with 5 successful startups under his belt including the recently launched <a href="http://cleverandy.com">http://cleverandy.com</a>.&nbsp; He has become something of a cookie! jar of startup knowledge. When he is not managing his team of contractors he blogs about the trials and tribulations of his startups at <a href="http://tumbledry.ca">http://tumbledry.ca</a>. </p>

<hr />

<p>It all started with an idea at 4 a.m. on a Tuesday morning that brought us to CodeIgniter. <br />
We were neck deep in a deadline and sinking fast. We knew we needed help. <br />
After puling some strings that bought some time we quit work for a week - well, client work at least. There were our own issues to solve.</p>

<p>We had amassed a team of roughly 14 at this point and had no way to efficiently manage who was doing what for how much and how long; in fact we were often surprised by code submissions.<br />
That’s a sad place to be.</p>

<p>We had been building in the ‘flavor of the weak’ when it came to frameworks and often chose whatever the contractor was fluent in to save time (which != saved money). </p>

<p>Not only were we not communicating, but we were reinventing the wheel for every project. Have I mentioned how sad of a place that is to be?</p>

<p>Back to 4 a.m.</p>

<p>Doug is one of my closest friends, and a trusted peer. He suggested we should develop a contractor management system and that we should build it all on CodeIgniter. At this time I hadn’t seen sleep in nearly a day, consumed almost seven liters of coffee, the &#8220;development tub&#8221; was empty and we were trying to finish a RoR project that a contractor bailed on. I didn&#8217;t want to hear about another &amp;^%in framework, I just wanted this to be done. </p>

<p>Thankfully my friend couldn’t understand the word “no” and kept pressing. He went on about how anyone with knowledge of PHP can build with this, its development cycle and the community that was forming around it. I still wasn&#8217;t convinced but he assured me this would be the last time we changed frameworks and proposed a friendly bet.</p>

<p>I hate that I love gambling. I don&#8217;t have a problem, per say, but I always lose. The problem is that my pride drives me to bet anyways. Besides I relished the opportunity to prove him wrong. </p>

<p>So the bet was laid. We would build the contractor management system in CI and all client projects for one month with CI. At the end of that month if I wanted to go back to another framework and could justify it rationally with solid points then he would keep the Development Tub full for a full year (a cost of roughly $100/week). If we stayed with Code Igniter I would the one stocking the tub for the next year and I would also have accept his offer to buy into my company and become a partner. </p>

<p>On Wednesday morning we filled the tub (again not a problem&#8230; really) and set out to build our app. We outlined what we wanted, mapped it out on the whiteboard, set up a Basecamp project for it, defined our milestones and set Saturday as launch day. </p>

<div style="text-align: center;"><img src="http://codeigniter.com/files/ci_blog/DSC_9399.jpg" width="300" height="199" alt="The tub&#8230;" /> <img src="http://codeigniter.com/files/ci_blog/DSC_9400.jpg" width="300" height="199" alt="The tub&#8230; again" /></div>

<p>Beer? Check.<br />
Monster energy drinks? Check.<br />
Coffee? Check.<br />
M&amp;M Peanuts? Check.<br />
Babysitter? Check. (We&#8217;re parents&#8230;)&nbsp; <br />
Pizza? Maybe.<br />
Basecamp set up? Check.<br />
SVN Server? Check.</p>

<p>While I depleted the tub and read the user guide, Doug was getting down to business. By the time I’d figured out how I was going to tackle my portion of the build he’d built the user authentication as well as the management section. Doug was already adding features to our &#8220;Wish List&#8221; in Basecamp and checking off milestones. Roughly 9 hrs into our project we started completing items on the wish list, which had never happened before. The wish list had never become a checklist before a deadline and I was starting to worry.</p>

<p>In the wee hours of Thursday morning we headed home to sleep. The following day we sent login details to our contractors and set up a basecamp project to log bugs. We fixed the stupid little ones that we missed and made changes on the fly. By the end of the day I had a huge overview of our team of contractors and a vision of things to come. I never did see the 48 hr Milestone reminder emails from Basecamp&#8230; again I was seeing a change.</p>

<p>By the end of the month we had more than a few client sites built on CI. We also had a process for development laid out and the term Rapid Development was taking on meaning with me. I was happy, the clients were happy and we had a team we could manage&#8230; and then reality sunk in.</p>

<p>I hate losing, even more so I hate losing to people I like winning against. I lost the bet. Though I gained a valuable business partner, a managed team, profitability and a kick ass framework to build it upon&#8230; I am forever filling the tub.</p>

<p>And with ExpressionEngine 2 built on CI (Which we are using extensively for client sites now), the tub has gained a lifetime sponsor. Me.</p>

<p>That app was build on 1.4.0 on September 20th 2006 and since then we have revised many things including our checklist:</p>

<p>Beer? Check.<br />
M&amp;M Peanuts? Check.<br />
Basecamp set up? Check.<br />
SVN Server? Check.</p>

<p>See the difference? We don&#8217;t live at the office any more. CodeIgniter gave us the freedom to build around our needs and wants and it gave us the structure we needed to become more efficient. Just don’t bet against CI, it has cost me $8800 and counting&#8230;. weekly.</p>

<p>
</p><h3>ABOUT LEE</h3>

<p>Lee is a bit of a serial entrepreneur, with 5 successful startups under his belt including the recently launched <a href="http://cleverandy.com">http://cleverandy.com</a>.&nbsp; He has become something of a cookie! jar of startup knowledge. When he is not managing his team of contractors he blogs about the trials and tribulations of his startups at <a href="http://tumbledry.ca">http://tumbledry.ca</a>. </p>

<p><a href="http://codeigniter.com/forums/viewthread/85844/">Discuss this article</a>
</p>]]></description>
      <dc:subject>Community Voice</dc:subject>
      <dc:date>2008-07-21T20:33:00-06:00</dc:date>
    </item>

    <item>
      <title>CodeIgniter Community Chieftain Michael Wales</title>
      <link>http://codeigniter.com/news/codeigniter_community_chieftain_michael_wales/</link>
      <guid>http://codeigniter.com/news/codeigniter_community_chieftain_michael_wales/#When:19:33:00Z</guid>
      <description><![CDATA[<p>We&#8217;re happy to announce a new program for exceptional members of the CodeIgniter community, <a href="http://codeigniter.com/forums/viewannounce/85513_49/">CodeIgniter Community Chieftains</a>.&nbsp; As the community grows, the EllisLab development team often does not have the time that we would like to interact with the community in various ways, but it&#8217;s always been a key part of our success.&nbsp; So as the need arises, we have created this program to help keep the wheels greased so to speak, making sure that our forums, wiki, and bug tracker are handling the needs of the community and are properly moderated.</p>

<p>This is an invitation only program as the aforementioned link explains, and we&#8217;re proud to bring <a href="http://codeigniter.com/forums/member/48108/">Michael Wales</a> on board as our first CodeIgniter Community Chieftain.&nbsp; Most will need no introduction to Michael as you have likely already encountered him or some of his contributions in the community.&nbsp; Welcome aboard, Michael!
</p>]]></description>
      <dc:subject></dc:subject>
      <dc:date>2008-07-17T19:33:00-06:00</dc:date>
    </item>

    <item>
      <title>CodeIgniter Brazil</title>
      <link>http://codeigniter.com/news/codeigniter_brazil/</link>
      <guid>http://codeigniter.com/news/codeigniter_brazil/#When:18:08:00Z</guid>
      <description><![CDATA[<p>Hermes Alves has launched a CodeIgniter resource in Portuguese, located at <a href="http://www.codeigniter.com.br">codeigniter.com.br</a>.&nbsp; The site includes a discussion forum, mailing-list, and a few other resources.&nbsp; Kudos Hermes! 
</p>]]></description>
      <dc:subject></dc:subject>
      <dc:date>2008-07-08T18:08:00-06:00</dc:date>
    </item>

    
    </channel>
</rss>