Recommended Stuff
Browse archives
Mo | Tu | We | Th | Fr | Sa | Su |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Blog Entry Categories
- Astronomy (2)
- Cognitive Science (2)
- Computer & Video Games (2)
- Computers & Hardware (2)
- CSS (3)
- Drupal (7)
- Human-Computer Interaction (11)
- Internet (4)
- Linguistics (1)
- Miscellaneous (1)
- Movies & Film (2)
- Music (5)
- Personal (1)
- Philosophy (1)
- phpBB (4)
- Politics & Society (10)
- Portfolio Updates (4)
- Psychology (3)
- Reviews (1)
- Science (1)
- Science-Fiction (1)
- Software & Applications (1)
- Templates, Themes and Skins (4)
- Travel (8)
- Usability (9)
- Web Design (11)
- Website Updates (4)
- XHTML (3)
Blogs/Sites I Like
Recent
Recent blog posts
- Five perhaps not-so-known PHP tricks for leaner and cleaner code
- PHPEclipse and PDT
- Kilowatts & Vanek are back, better than ever
- The future of my phpBB templates
- Checking in
- Web Design or the Art and Science of Solving Problems (Part 1)
- Lost in thought
- An easy way to display a customized menu in your Drupal theme
- Back on the blog with a CSS rant
- Eternal* fame on the red planet for free
Search this site with Google
Related Nodes - my first Drupal module
Many blogs list related blog entries as "Related Articles", however currently this isn't something that Drupal supports, nor could I find a module that does. It seemed I would have to write my own module, so yesterday I started working on what was to become my first Drupal module. It's called 'Related Nodes'.
Related Nodes is based on this code snippet for showing other nodes that have certain taxonomy terms associated with them. Problem with the snippet is that it doesn't use the terms associated with the current node being viewed nor can you specify what node types you want it to show which is why I decided to write a module.
The decision to develop it as a module rather than as a block was because a block's content would inevitably appear after $content in the template, so comments, links and the trackback would appear above it. I need the list to appear directly under the node's content. The purpose of the list of related articles is to present relevant content and there's no point in that if people don't see it, is there?
The module works in the fashion that every node type for which you have enabled it, it will, at the end of the node's content show a list of eight (default value, but you can configure it) other nodes. What nodes are being listed is determined by:
- whether the node to be listed shares terms with the current node (the node being viewed)
- whether its node type is one of the node types selected to be listed as a related node
So the listed nodes are nodes that share terms with the node being viewed, but not just any terms. Since many websites use taxonomy vocabularies to structure content and many nodes might possible share terms but still not have the kind of relationship we're looking for here, I've limited this to one vocabulary. At my site I use the vocabulary I call Topics to find other nodes of the type "personal blog entry" that are about one or several of the topics (Topics vocabulary terms) the current node is associated with.
The module isn't complete yet, work remains but it's complete enough to be used here and will be released eventually. You can see some examples of it in action on another node, not this one however as at the time of writing no other nodes are associated with the same terms.
Plans for other features:
- possibility for configuring what node types to be listed on a per current node's node type basis
- when no nodes are found, list random nodes
- possibility to show teaser, or part of teaser