I’ve a block, created in the views module, where I post the most recent comments made by a user (e.g. the five most recent comments for user uid 1033). I’ve created my own tpl file so I can customize which fields I want to display and it works.
It prints the first 140 characters of the comment and link to the node with the #cid behind it.
But underneath that I want to show which node-type it is posted in. I tried by using this code:
print $node->type;
but that – of cause – just prints the node type and that is not especially human readable so what I want is the node name (from the database class “node_type”) but I just can’t get my head around how to do that.
Is there any easy way or do I have to use some kind of customized query / API call??
Take a look at node_get_types() api function.
http://api.drupal.org/api/drupal/modules--node--node.module/function/node_get_types/6