April 02 2008
Kinda old news, but I wanted to post about it. My favorite web publishing platform, , is looking to release version 2.0 sometime this summer. Ellis Lab, the people behind Expression Engine, are also the force behind the Open Source . They have announced that EE2.0 is powered by Codeigniter. To me, this is incredible. The possibilities are endless.
At South by Southwest during our “ExpressionEngine 2.0 sneak preview” I got a chance to reveal some big news about the future of ExpressionEngine that I wanted to explore in some more detail here for anyone who wasn’t able to attend.
ExpressionEngine 2.0 is built on CodeIgniter.
CodeIgniter is our Open Source PHP based framework. You can learn more at CodeIgniter.com, but in a nutshell it’s the toolkit that many powerful applications are built on, and now we can add ExpressionEngine to that list.
This is great news if you’re an ExpressionEngine user, a CodeIgniter user, or both. As an ExpressionEngine developer you will have a greatly expanded community of talented developers working with you, and for you. I said during my talk, “The nerds are excited, and you should be excited that the nerds are excited”. As a dyed in the wool nerd, I stand by this!
If you’re a CodeIgniter developer, this means you can drop a full-fledged content-management system right on top of your existing code base, and have it work. You want a forum installed? One click. You want need member management, a wiki, end-user tools, mailing lists, mobile blogging capabilities, permissions… all there. One click. Proven, simple, powerful.
Very exciting! Since I started using Codeigniter at version 1.0, I have noticed a huge increase in my productivity, and a huge leap in my knowledge of php and web programming. There is something about coding with Codeigniter that inspires clean, elegant code. A good example of the power of Codeigniter is a very basic CMS I had put together for Noble Studios. It worked, but it wasn’t pretty. It was one hack on top of another, with a bunch of pieces glued together that was very slowly turning into a usable framework/CMS, but I simply do not have the time or resources to properly develop it. We work very quickly and I had to do what I had to do. However, this latest project gave me a chance to revisit the very core of this CMS and I saw the opportunity to do it right. I chose Codeigniter as the core and was able to produce a marketable, flexible, and maintainable application in a fraction of the time it took to build the original. I am most happy with the ACL/User Authentication system, and I am considering ripping it out and making it available as an app for the community. The point is, a good framework really does allow you to spend more time on the real functionality and value of an application. And with EE as the CMS and the power of this framework, we can tackle much larger development projects in the same amount of time as doing it from “scratch”.
March 26 2008
Codeigniter ships with a captcha plugin that is not documented in the User Guide. The code is commented well and has examples though. This is how I used the captcha plugin with form validation to help stop spam on a basic contact form, without using a table in my database. It seems unecessary to add this call to MySQL when we could easily just store it in session.
First, our controllers method. This handles setting up our form validation rules, building the captcha, and storing the captcha data in a session for retrieval later. We have a rule for our captcha field that is a callback to our validation function, “cinput_check”.
<?php
function contact()
{
$this->load->library('session');
$this->load->plugin('captcha');
/* Setup captcha defaults */
$captcha_defaults = array(
'img_path' => './images/captcha/',
'img_url' => 'http://site.com/images/captcha/',
'img_width' => 200,
'img_height' => 50,
);
$this->load->library('validation');
/* include your additional form field rules here as well */
$rules['cinput'] = "callback_cinput_check";
$this->validation->set_rules($rules);
/* include your additional form fields here as well */
$fields['cinput'] = "Captcha";
$this->validation->set_fields($fields);
if ($this->validation->run() == FALSE)
{
/* since validation failed, generate new captcha
data and update the session */
$cap = create_captcha($captcha_defaults);
$form_tpl['captcha'] = $cap['image'];
$this->session->set_userdata(array('cinput'=>$cap['word']));
$this->load->view('site/contact_us', $form_tpl);
}
else
{
/* Continue to process form */
}
}
?>
This is our call back function, and validates the posted captcha value against the generated value stored in session. For some reason checking $str against the value in $this->session was not working, so I simply bypassed that and used the value from the input handler.
<?php
function cinput_check($str)
{
if ($this->input->post('cinput') != $this->session->userdata('cinput'))
{
$this->validation->_error_messages['cinput_check'] = 'Incorrect Captcha characters.';
return FALSE;
}
else
{
return TRUE;
}
}
?>
The form is just a generic form, but here is what the captcha field looks like for reference:
<p><?php print $captcha; ?><br />
<label for="Captcha">Type in the code:</label>
<input type="text" name="cinput" id="Captcha" value="" /></p>
For more information on check out their extremely well documented .
February 21 2008
I wanted to talk a bit about working in an extremely unorganized and fast paced environment, and what I have learned to keep my code from blowing up in my face. In the ideal environment we would have the luxury of a development server, a staging server, and a production server, with proper source control and debugging/qa testing. When I say server, I really mean environment, these setups could consist of more than one server, but for the sake of just writing as I think, i’ll say server. What we really have is one server that acts as both development & production. Seriously. No, i am not joking, i’m serious here. We also have management that requires work gets done in unreasonable time frames. Such as, we need a custom CMS in 2 weeks with X number of specific features that really should have been planned out and analyzed and put into some sort of project specification before we begin work. Did I mention that I also have to cutup the html and css, and create all the required templates? No small task.
Read More »
February 11 2008
Yeah, this image sums up my weekend. I started reading the Django manual. Holy shit, I am way impressed and absolutely love it. I wish I would have gotten into Python earlier.
February 05 2008
Everything old is new again, and though the rise of 3D games has made sprite maps obsolete, the concurrent rise of mobile devices with 2D gaming capabilities have brought them back into vogue. And now, with a bit of math and a lot of CSS, we’re going to take the basic concept and apply it to the world of web design.
Specifically, we’re going to replace old-school image slicing and dicing (and the necessary JavaScript) with a CSS solution. And because of the way CSS works, we’re going to take it further: by building a grid of images and devising a way to get each individual cell out of the grid, we can store all buttons/navigation items/whatever we wish in a single master image file, along with the associated “before” and “after” link states.
This is a pretty , and definitely something to look into.
February 02 2008
I sat down this morning to try to outline a few of our processes at work that are a bit on the blurry side. There is no accountability for tasks, and for that matter, there are not any real roles defined to assign tasks to. In an effort to bring it all into focus I started creating a flowchart of a web development project. I also created flowcharts for handling a new client as well as one for working with SVN. I can’t believe it required a flowchart to visualize the process of creating/handling a new client, but it is apparently a bit more work than I thought. Anyways, back to the topic at hand. Graphs and charts!
Read More »
January 08 2008
To be XHTML strict you cannot use the target attribute in anchors. This means you cannot use target="_blank" to open a link in a new window. Sometimes this is the desired behavior, you simply do not want people to navigate away from your site, yet you want them to be able to view a resource you have linked to. My solution, which I think I grabbed from a javascript book I got a while back, works by taking advantage of your clean XHTML. All you need to do is add a class called “popup” to your anchor and you are ready to roll. Or popup, as the case may be.
Read More »
December 19 2007
I wanted a front end for and wanted to be able to quickly show what is currently playing, the recently played tracks, and how many people were listening. I didn’t want to mess around too much, I just wanted to get something online. So, within about an hour, I installed Codeigniter and created a model and library for scraping the shoutcast stats from the shoutcast admin interface. I found a class for shoutcast from PHPClasses that I was able to modify for my needs. It didn’t require anything more than adjusting the class name. Codeigniter has some restrictions in regards to file names, but I haven’t run into any real issues with that yet.
Codeigniter makes it very easy to quickly create working, functional web sites. It would have taken me several days to build this while providing the same level of customization and expandability that this framework provides.
Read More »
December 15 2007
I recently setup a server and wanted to hide the port I was using. I don’t like nasty looking URLs like the following: http://radiostation.com:8002/listen.pls. I wanted to be able to type out the address much easier than that, something like http://radiostation.com/listen.pls.
What I ended up doing was create a simple PHP script and a mod_rewrite rule to create the link.
Here is the PHP script:
listen.php
<?php
header("Content-type:audio/x-scpls");
echo "[playlist]
NumberOfEntries=1
File1=http://lunchboxradio.com:8000/";
?>
It is sending the document as a media type instead of an html doc, which causes your browser to attempt to download it instead of displaying the files contents. Generally you will be prompted to open the file in your default media player, which will usually be fine to listen to the stream.
Instead of pointing users to a PHP file, I wanted to direct them to a PLS. You just need to add a rule to an htaccess file that redirects all requests to FILENAME.PLS to FILENAME.PHP and voila, you are done.
My .htaccess file:
.htaccess
RewriteEngine On
RewriteRule ^LunchBoxRadio.pls$ listen.php [L]
Now I just have to link to http://lunchboxradio.com/LunchBoxRadio.pls to listen to the stream. This is way better than the long ugly URL that is the default.
November 01 2007
I build a lot of websites. In fact I build too many websites. Every time I do build a site, I notice that I spend far too much time troubleshooting the basic layout in IE6, IE7, and Firefox2.*. Life would be so much simpler if I simply had a few common layout templates I could use as my base. And that is exactly what I have created. They are nothing to look at right now, but they provide a very simple framework for quickly developing the html/css structure of a website. I have tested the layouts in Internet Explorer 6 and 7, Firefox 2, Opera 9, Safari 2 for OS X, and Safari 3 for Windows.
Read More »
Page 1 of 2 pages 1 2 >