Can you add human readable name also? Both are useful for different purposes, but a human readable version would be great, thanks :)

Comments

Anonymous’s picture

Assigned: Unassigned »
Status: Active » Postponed (maintainer needs more info)

I'm not sure what you mean, what variable is this ? I can't find any similar thing in node.tpl.php
Do you mean the node-type class ?

Anonymous’s picture

No, not a class, the variable "$type" in node.tpl.php prints out "forum" or "blog" or "story", etc. I'd like a variable that prints out "Forum Topic" instead of "forum", "Blog" instead of "blog", etc.

SteveK’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

This can be added quite easily through the page preprocess function if needed. I don't believe this is feature worthy since it creates "class" bloat and redundancy with pre-existing classes.

Anonymous’s picture

Hey Steve, you're traveling!!
Get out of Drupal.org !!!

Anonymous’s picture

Well, can you tell me how to do it? "Easy" is a relative term, depending on how much you already know.

Anonymous’s picture

Category: feature » support
Status: Closed (won't fix) » Fixed

You could use this simple snippet for replacement, but you will have to declare each type (meaning, adding each type case and its replacement) :

  	  <?php if ($type) {
  	    if ($type == 'story') { echo 'Story';}
  	    if ($type == 'blog') { echo 'Blog';}
  	    if ($type == 'forum') { echo 'Forum Topic';}
  	    } 
  	  ?>

Makes sense ?

Anonymous’s picture

With that, do I only need to put that chunk of code in the template once, and then every case of $type would give me the altered version wherever $type is within the template, or do I have to put that in the place of every instance of $type in the template? I was hoping to avoid the later, but I can work with the former. Ideally it wouldn't have to be manually edited when I create a new content type, but if that's my only option it'll work.

Anonymous’s picture

Yes, you would have to create a case for each possible type.

Anonymous’s picture

Status: Fixed » Closed (fixed)
Anonymous’s picture

That's not what I meant. I meant in the template, would I put those type definitions in only once, or would I have to put that chunk of code in anywhere in the template that the $type variable is placed?

Anonymous’s picture

This chunk of code is really just a string replacement. So if you want to output the $type variable two time, yes, you'd have to put that chunk two times.

chawl’s picture

Nonsense, use this.

Anonymous’s picture

Thank you! I knew something straight forward like that had to be available somewhere!