Hello, I need to add a "Related Articles" link into the $terms (or $node->links, but $terms is preferable) Unfortunately, after buzzing arond the code for 2 hours, I have not found where it is. I am an experienced PHP programmer, I just need to be pointed to what file I should be looking at to accomplish this.

Thanks

Comments

michaelangela’s picture

You can probably just add to it. Usually in your theme you can do stuff like that in page.tpl.php or node.tpl.php I believe... That is for phptemplate I think though. I am not familiar with the others like smarty or xtemplate. Is that sort of thing possible in your theme? Which theme engine are you using?

edit...

There is a link generating function that you can call to build the link for you, too. It is l() but at the moment I forgot the parameter list. It is in the API though. And for some reason I can't get to http://drupaldocs.org/api/4.6 right now... But it's in there. You may see the call in other code as well as t(). It's in common.inc I believe in the includes folder if you want to see more about it.

I hope that helps. If I can find the function call for it I'll try to post it up.

--------------------
Michael
http://michaelangela.name

webfinesse’s picture

ok thanks for the hint. The problem now is the taxonomy functionality

really what i need to add

$terms .= ' | <a href="/taxonomy/term/'.$term_id.'">Related Articles</a>';

the problem right now is I do not know how to get the taxonomy term ID for the node. Appearently drupaldocs.org is down which probably contains my answer.

michaelangela’s picture

Try loading up the devel module for some of this testing. You can use it's nice dprint_r() function to print out variables you are testing for. I'm wondering if there is a way to pull a variable for related articles...

--------------------
Michael
http://michaelangela.name

webfinesse’s picture

Here is my solution. It may not work for you if you are using multiple terms for articles otherwise....

Place this at the top of your node.tpl.php file

if($node->type == "story")
{
	$terms_array = taxonomy_node_get_terms($node->nid);
	$terms .= ' | <a href="/taxonomy/term/'. key($terms_array) .'">Related Articles</a>';
}

Thanks all