PHP

Using Database-level Foreign Keys in Drupal 7

Published on Thu, 2011-10-06 - 16:05

If you use a good database system, foreign keys is an actual concept on the server that is used to enforce data integrity.

With database-level foreign keys, it becomes impossible to break your data by deleting data referenced by other data, without also dealing with the referenced data.

In practice this means that deleting a node from the database could be as simple as DELETE FROM node WHERE nid = 53 CASCADE, and conversely it would not be…

Things that should be objects in Drupal #1: Content types

Published on Mon, 2009-06-15 - 11:23

Currently, defining the simplest content type in Drupal requires ~54 lines of 100% standard boilerplate code.

The reason Object Orientation would be good here is the simple concept of inheritance.

Very simply, my 54 lines of code could be replaced by something like:

class CampaignContentType extends NodeContentType {
  // Custom functionality here.
}

I think I'll go see if I can help Crell with his objective somehow :)

Tags

Snippet: node type specific CSS files

Published on Fri, 2009-01-02 - 21:45

I just wrote a fun little bit of code for answering a question on our Danish Drupal community site.

The user in question wanted to add different CSS-files, depending on the type of the node used as the main page content, and I just wanted to share a little bit of code demonstrating how much can be a achieved very easily with Drupal's very flexible theming system.

So with no further ado, here it is:

/**
  * Override or insert…
Tags

TurboGears is brilliant

Published on Wed, 2006-06-21 - 22:46

Some time ago, I wrote a small piece about TurboGears, with a link to a review I read on O'Reilly.

Since then I've studied and played with it a lot, and I can only say it's changed my worldview quite a bit. As those who know me, know, I've tinkered with programming for the web since autumn 2002, where I started with some rather immature PHP-hacking. Since then, I've learned a lot. Studied "real" programming languages, like C,…

Tags

Moving to greener fields

Published on Tue, 2006-05-23 - 07:42

So, I've changed webhosting-companies. Now I use TextDrive.

I won't go into a long story about what has driven me to this, but all I can say is that I've had a lot of trouble with hosting in the past, and now I've gotten to the point where I've realised that cheap hosting is... cheap. And for a reason.

So now I pay a lot more for it, but at least I'm sure it works the way I want…

Tags
Subscribe to PHP