Tag Archives: PHP

WordPress plugin and database data

So I’ve created the tables for my Unit Tracker plugin and created some dummy data for an initial example Tracker. As nice as this is I’m not entirely sure about how I’ve designed the tables (read that as saying “if you think this is a mistake comment“). My assumption is as follows for the pure basics, you will need at least 2 tables;

Table 1 – Trackers

A table to store all the different units being tracked, there can be a number of different units tracked, or maybe even a set of units tracked in tandem for example body-fat % , weight and stomach measures.

  • Name and Description of the tracker
  • Link to a post/page further describing the details about the tracker
  • A display Reference (something like a permalink) that can be used to display the tracker
    • for example [:tracker-weight:]
  • Validation, due to the fact that any unit may be added a validation key will be added here (regex?)
  • Unit Measurement, because people might be measuring lbs, Stone (British measure), Kg, % or Quarks the unit of measurement is left blank and assigned by a user (but there will automatically be a suggested one in the form)

Table 2 – Tracker Values

A table to store all the values recorded by the user. This is so in the future we can use this data to map graphs, allow cvs downloads e.t.c.

  • Value, this I have decided to store as a string, now I may well regret this but it seemed the easiest way to store data of any type including time (hours/days/months/years) weight can be stored in Metric and converted as necessary. The method of extracting and processing the data is based on the validation in the Tracker table. You can’t change the type after the Tracker contains data.
  • Created, the date that new a new data value was added to the tracker
  • Tracker Id the ID (primary key) of the tracker the data belongs to.

Of course this isn’t all, there will be probably options stored in the WordPress options database table to decide on appearance, widget placement etc, additional tracker values that show targets, method of display, change over a period of x, and many more…

First of all I’ll settle with the above as an Alpha 0.0.1 release and when this works I’ll add accordingly.

Zend Framework and back to the grindstone

So I have returned to PHP from a long absence trying to get my head around the Zend Framework via it’s manual. It’s somewhat error prone and doesn’t accurately describe what you always need to do but I got the quickstart project up and running. I think I’ll work through the available chapters till the end and experiment locally until I create a Zend application on this site to show what I can do.

I also have a few books arriving that should give me a step by step process of learning practical Zend programming. I am already impressed by it’s potential but I need to get much more familiar with both the framework and my knowledge of PHP before I feel comfortable with it all again.

On another note I want to start tracking my hours of work on various projects to see my progress so I’m looking at creating a simple WordPress plugin that can store and display hours spent on something. Or more to the point add all the hours I give it together with some nice script. I want to show how many hours of experience and learning I have towards 10,000 hours (the supposed mark of an expert). While I’m a long way off at the moment, It is a noble goal to aim towards.