Display only tags (and not other category types) below your content
In node.tpl.php, the following code shows links to all categories to a node, regardless of what kind of categories they are.
If all you want are to list the tags, use the following PHP snippet in place of the code that displays categories. You will need to know which vocabulary you've set as "free tagging", that is, which vocabulary ID. Change the first line to reflect your settings. If you don't yet have a vocabulary set to free-tagging, click administer » categories » add vocabulary tab and check the box next to "Free tagging" after you've filled in the other required fields.
So using the in-browser theme editor (see our instructions on setting up the theme editor and using it), replace the code in node.tpl.php above with the code below, and it will show a comma-separated list of tags linked to their individual taxonomy pages.
<?php
$vid = 1;
$result = db_query("SELECT t.tid, t.name FROM {term_data} t, {term_node} r WHERE r.tid = t.tid AND r.nid = %d AND t.vid = %d ORDER BY weight, name", array($node->nid, $vid));
while ($term = db_fetch_object($result)) {
$tags[] = l($term->name, 'taxonomy/term/' . $term->tid);
}
if ($tags) {
print t("Tags: ") . implode(', ', $tags);
}
?>
Comments
tag and a category
That clearly explains the difference between a tag and a category . However,it will help more if usage of each one is explained. I understand each one has specific use. It may depend on requirement.
Nobody gets to live life backward. Look ahead, that is where your future lies.
Clarification
How does this differ from the default way tags (AKA terms) are displayed after posts? Specifically what is the difference between a "tag" and "other category types"? Is a tag specifically a term set by free-tagging? And are "other category types" terms that have either parent or children terms? And lastly, are "terms" and "categories" conceptually the same thing, if not, how do they differ?
Thanks.
Lots of Questions
"Specifically what is the difference between a 'tag' and 'other category types'? Is a tag specifically a term set by free-tagging?"
Yes. The difference between a tag and a category is that you can create new tags (which are categories, actually) on the fly when you're posting, where if you don't have it set for 'free-tagging', you have to go into administer » taxonomy to create the categories.
"Specifically what is the difference between a 'tag' and 'other category types'?"
In the context of this article, "other category types" refers to vocabularies that are not set to 'free-tagging'.
"are 'terms' and 'categories' conceptually the same thing, if not, how do they differ?"
Yes, "terms", in the context of this article, is Drupal-speak for "categories".