My Profile Photo

Personal Webpage of David Duggins


Well, I was born on a normal day in July, 1981 and have been creating chaos ever since. Born in North Carolina, but raised in the aftermath of the Soviet Union, Kazakhstan, I have been messing around with computers nearly my entire life. I wrote my first program in assembly when I was 11. In my early teens I ran a BBS connected to Fidonet and started building a website for my band. In 1999 I was introduced to Linux, and it was love at first compile. I started my career in IT in the early 2000's doing IT for a Car Dealership in Charlotte NC. I wrote my first major web app in Cold Fusion (an ecom app) at that time. In 2006 I left Charlotte and moved down to Columbia where starting working as a developer, freelancer and consultant. Currently I am working as a freelance developer and DevOps consultant!!


Finally, the feed works

I finally had the time to sit down and write a RSS feed for my blog. I obviously wrote it in php using codeigniter. There are a few good tutorials out there, but let me add my own ten cents to the pile!!\n So the first spot is the controller. I created a controller called Feed. I also could have just created a method under my Blog controller, but I find this is a little bit neater code.

function index()
{
    $this->load->helper('inflector');
        $this->load->helper('xml');  
    $this->load->helper('text');  
    $this->load->model('Blog_model', 'blog');    

    $data['entries'] = $this->blog->get_last_ten_entries();
    $this->load->view('rss', $data);


}

This loads the required CI helpers, as well as by Blog Model. Notice that I am using a custom method in my model to retrieve the last ten entries. I am reusing the same method that populated my main blog page.

The first thing to remember regarding the xml page that you define in your view is opening the xml using the echo statement. The syntax would otherwise confuse the compiler. After that we just use pure XML and insert our dynamic data with php short tags. Surprisingly enough, that is it!

© 2024 David Duggins. All rights reserved.