Taxonews Or Similar Entries Drupal 6.x Modules?

With Drupal there are so many modules out there finding just the right one makes it worth the adventure. One of the first ones that I found was the Similar Entries Module, later I found the Taxonews module.

Both of these modules offer something for a Drupal 6.x installation although Taxonews as this is being writen is still in the release candidate mode it appears to work very well.

At first glance it appeared to me that they would provide the same display of content. That is not quite what I’ve found and I’m sure as the site grows in content this will change even more.

With Taxonews, I could place the blocks across the entire site, which I did in the beginning. It wasn’t until later it came to me that I should be able to show the individual blocks by taxonomy terms.

I started searching, and it really did take awhile to locate the code that I would need to accomplish this. I guess I should learn how to code PHP, one of these days I’ll get there.

I finally found what I needed, yet it was listed under Show block by taxonomy term – 4.7 yet there was a reply by sebos69 that provided exactly what I needed.

Now I could display the most recent blog posts, along with a block that really will keep the posts organized by taxonomy. This should make it easy on a site that covers a wide variety of topics.

With the Similar Entries module, pulling in posts that are not exactly related to the original post, it makes me wonder if the title and text of certain posts are not really theme related.

This leads into the question of could this module be used in a SEO way, to keep your posts related and on topic. Still we need to write for visitors and not the various search engines.

Here is the code I used for the blocks for taxonews:

<?php
if ( arg(0) == 'node' and is_numeric(arg(1)) and arg(2) == FALSE ) {

// Vocabulary term ID for which to display the block:
$displayTermID =1;

// Get all taxonomy terms for current node:
$currNodeTerms = taxonomy_node_get_terms(node_load(arg(1)));

// If there are no terms, fail-fast:

if (is_null($currNodeTerms) || 0 == count($currNodeTerms)) {
return
FALSE;
}

// For each term of the current node, get all the ancestor terms:
foreach($currNodeTerms as $term) {

$ancestors = taxonomy_get_parents_all($term->tid);

// Check for each ancestor term whether it is the term we are looking for.
// If it is, return TRUE immediately:
if (!is_null($ancestors) && 0 < count($ancestors)) {
foreach(
$ancestors as $ancestor) {
if (
$displayTermID == $ancestor->tid) {
return
TRUE;
}
}
}
}
}
// If we didn't find our term of interest, return FALSE:
return FALSE;
?>

Comments on this entry are closed.

  • dalin Oct 24, 2008 @ 19:52

    But what to do when you want to expand on the functionality of a poorly written module? Sometimes re-starting from scratch is the only way to do it right.