For nearly as long as I can remember, I've been trying to simplify my programming projects by breaking down long repetitive tasks down into as short and concise steps as I can. I shudder to think of the hours in my life spent putting together a web page that reads a list of items from a database, filters or transforms them, then renders out the appropriate html and attachments. So many times have I done this, across many languages, projects, and technologies.
For the past two years I've been reforming my interest in web, to an interest in mobile web. During this time, I've also run through all my regular distractions like creating a little mobile RSS reader, a mobile client profile database for a cousin, a mobile plumbing inspection checklist for another friend. All these very different projects have a lot in common. They need to capture, edit, delete and list objects. Throw in a little menu navigation and there you have a system. My goal with this PHP/JQM MVC project is to turn my dev cycle for small projects into 90% deciding what I want, 10% typing it in.
Now since I'm targeting mobile devices, form layout can simply default to a vertical list of form controls down the page. All that's really left is deciding what data needs to be captured in my simple data capture app. Here's an example set of definitions...
The Client Profile Demo
There are three object models there: A client, a client state, and a product. Clients have several details, among which is a state. They can be in only one state at a time. Clients can have many products. That may or may not look like a lot,.. but what does it get you?
- Six tables in your database, three data tables, each with a respective log table tracking all changes
- An API on the serverside to manipulate that data
- Clientside forms to edit instances of each of the models
- Some simple regex error detection in the forms
- Overview and list pages to navigate the data
- A dashboard to hold it all together
- The login procedure and managing users are also thrown in already
Download and Setup
You can freely download, copy, hack and sell this project from GitHub. To setup your own mobile app, the general process is as follows:
- Copy this project folder into your htdocs or respective web directory
- Edit the app/schema.json file to define your models and views
- Delete any existing app/database.sqlite files (if you want to start from a clean slate)
- Open api/check.php in a browser. This will create any tables that don't exist
- Now open your mobile web app in a browser window
Some Caveats
As per usual, I offer this simply as a mostly working prototype. I was actively working on this project more than a year ago, but since then time and priority has led to the inevitable disregard of maintaining it. I still use it often when I need a little admin panel for a website or project I'm working on. I find it workable, but there are definitely bugs, and features half baked in. Have fun with it.
No comments:
Post a Comment