Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hey,
I'm really starting to love the possibilities content template has opened up for me, but in the midst of playing around with the output of the teaser and body content, I notice I can't seem to access the title at all or control the output in any capacity. Is there any way to update the $title output through contemplate? That would save me alot of trouble trying to configure automatic node titles because it's having a problem getting the current taxonomy term.
Any help would be appreciated.
Thanks!
Comments
Comment #1
jrglasgow CreditAttribution: jrglasgow commentedThe title is set before contemplate gets invoked. You can over write the title by invoking the drupal_set_title() function.
Does this answer your question?
Comment #2
rc2020 CreditAttribution: rc2020 commentedYeah it does, thanks.
I also wrote a node-type.tpl.php file, which sets the $title in addition to content templates, so I can use both interchangably, but its kind of an ugly fix...
Comment #3
philbar CreditAttribution: philbar commentedI would also like this functionality.
I'm trying to append an icon to the title of specific content types. It would be awesome if I could do it with Contemplate rather than having to dig into the theme code.
Marking as a "feature request" and activating.
Comment #4
jrglasgow CreditAttribution: jrglasgow commentedit is easy enough to do with contemplate currently, just use the drupal_set_title() function mentioned in #1
Comment #5
philbar CreditAttribution: philbar commentedI'm a novice when it comes to drupal code. Can you show me an example of how to use drupal_set_title() function?
I would like to take the title, and wrap it in a link.
So the title changes from
NODE_TITLE
to<a href="URL">NODE_TITLE</a>
.Thanks in advance.
Comment #6
jrglasgow CreditAttribution: jrglasgow commentedsomething like this
Comment #7
iantresman CreditAttribution: iantresman commentedI guess that if you wanted to change the position of a node's title, you could use CSS and set display:none, and then output it wherever you wanted with $node->title.