Closed (fixed)
Project:
Basic
Version:
6.x-2.2
Component:
Code
Priority:
Normal
Category:
Support request
Reporter:
Anonymous (not verified)
Created:
27 May 2009 at 16:15 UTC
Updated:
27 May 2016 at 00:23 UTC
Jump to comment: Most recent
Can you add human readable name also? Both are useful for different purposes, but a human readable version would be great, thanks :)
Comments
Comment #1
Anonymous (not verified) commentedI'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 ?
Comment #2
Anonymous (not verified) commentedNo, 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.
Comment #3
SteveK commentedThis 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.
Comment #4
Anonymous (not verified) commentedHey Steve, you're traveling!!
Get out of Drupal.org !!!
Comment #5
Anonymous (not verified) commentedWell, can you tell me how to do it? "Easy" is a relative term, depending on how much you already know.
Comment #6
Anonymous (not verified) commentedYou could use this simple snippet for replacement, but you will have to declare each type (meaning, adding each type case and its replacement) :
Makes sense ?
Comment #7
Anonymous (not verified) commentedWith 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.
Comment #8
Anonymous (not verified) commentedYes, you would have to create a case for each possible type.
Comment #9
Anonymous (not verified) commentedComment #10
Anonymous (not verified) commentedThat'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?
Comment #11
Anonymous (not verified) commentedThis 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.
Comment #12
chawl commentedNonsense, use this.
Comment #13
Anonymous (not verified) commentedThank you! I knew something straight forward like that had to be available somewhere!