May 31, 2008 Archives

Sat May 31 22:21:17 CDT 2008

Todo.txt part 2: php interface.

Last week I talked about using a text file to manage tasks. To make it as easy as possible for my wife to use it, I modified a php script to use as an interface. Now, instead of opening a terminal we leave the page open in Firefox.

The page uses a form to take input, specialized links to mark items as done, displays my list, and can even send the grocery list to the printer. You can view the complete source code here: todo.php.

The page is a heavily modified version of code posted to the todo.txt Yahoo! group. The original is nice and compact, but lacks several features that I like. The real work of the script is interaction with This is handled by php exec. (See line 110 for an example) Everything else is child's play. The php page takes data from either _POST or _GET, depending on the action.

Most of the data is posted with the form, and usually for the grocery list. I added the default value "add @buy " to speed item entry. In Firefox, the page automatically starts the cursor just after this text so all you need to do is type. Although others tested browsers (Opera, Konqueror, and IE6) all place the cursor at the beginning of the text box, we generally use Firefox so it shouldn't be a problem. If you want to use the script for yourself but don't like the default text, change it on line 77.

Posted by Nesman | Permanent Link