CakePHP news: Data Bindings v0.1 Example

You might know that I am involved in the [CakePHP framework](http://www.cakephp.org/) project, and I’m developing web sites with it now.

On the IRC channel today, I was alerted to the existence of the Bindings sister project. Now they have an example up, for all to see. Data Bindings v0.1 Example is a piece of very easy interaction between your PHP and the HTML the user manipulates.

Take a look at the “color box” example – yummy.

Delicious: Re-use of metadata

I have now added even more stuff to that bloated sidebar of mine.

Delicious sidebar screenshot with IDs

Perhaps you also have a delicious feed, and a WordPress blog? [Grab this plugin](http://www.w-a-s-a-b-i.com/archives/2004/10/15/delisious-cached/) to get started. The folks at Del.icio.us have made it really simple to use their data. Just look at [their documentation of their HTML feeds](http://del.icio.us/help/html).

> HTML feeds are available for users. This is an easy way to add your del.icio.us links to your blog.

(I opted for the “body” shape of the links, so you don’t need to hover the links to see the TITLE attribute in a tooltip.)

The picture shows how Mozilla Firefox’s Developer Toolbar displays the ID and class details of the HTML elements. Del.icio.us also gives me nice hooks for my stylesheet, thank you very much.

**Update:** For me to use the HTML feeds from delicious, I had to make them fit the presentation at my site, so I had to wiggle the charset a little, in the delicious.php plugin file. Line 42:

`  $response = utf8_decode(curl_exec($c));`

ActiveRecord outside of Rails: handy DB-tool

The popular web framework Ruby on Rails has a core part called ActiveRecord. That is the ORM, the object-relational mapper, which lets you use your database records “as objects” in your code.

With Rails, ActiveRecord is very powerful, but it’s not that bad on its own either.

Here is an example of using it as a microscopic SQL utility, for the two tables “seeds” and “products”.

Sean Treadway told me how to minimize the SQLing by just defining the Seed class. ActiveRecord detects all the column names on its own, so no need to type statements anymore.

And today I found out about the handy [clone](http://api.rubyonrails.com/classes/ActiveRecord/Base.html#M000739) method. It populates the to-be-created Product with the values of the parent.

Continue reading