Closed (won't fix)
Project:
Zen
Version:
6.x-1.0-beta3
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 Nov 2008 at 02:55 UTC
Updated:
13 Feb 2009 at 18:04 UTC
If someone unsets the node title for a teaser, the h2 tag with a link is still outputted. This creates stylist problems, as the h2.title tag often will have padding/margins associated with it.
Simple fix, just make sure the $title variable is set in node.tpl
Original:
<?php if (!$page): ?>
<h2 class="title">
<a href="<?php print $node_url; ?>" title="<?php print $title ?>"><?php print $title; ?></a>
</h2>
<?php endif;?>
Updated:
<?php if (!$page and $title): ?>
<h2 class="title">
<a href="<?php print $node_url; ?>" title="<?php print $title ?>"><?php print $title; ?></a>
</h2>
<?php endif;?>
I believe this is still an issue with 5.x, but I didn't bother to patch it.
| Comment | File | Size | Author |
|---|---|---|---|
| zen_node_title_conditional.patch | 385 bytes | kmonty |
Comments
Comment #1
johnalbinIf you unset the $title in a preprocess_node function, why not just set $page to TRUE? That would also prevent the
line from printing.
Since nodes always have titles, I'm not crazy about adding extra PHP to check for a condition caused by changing a variable in a preprocess.
If I'm wrong in my assumption that the “someone who unsets the node title” is a preprocess you created, feel free to re-open. :-)
Comment #2
kmontyI suppose you could set the page var to be TRUE, but couldn't that have other consequences? I don't believe it has issues in Zen by default, but I would imagine on a big corporate build it might. To flag a teaser as a page seems worse than adding a check.
My rationale is that if you are working with preprocessing, you are capable of editing your tpl conditions. That said, it was not obvious to me that h2 tags would be echoed out if there was no content to go within the tags.
I won't reopen because I understand your opposition, but I still don't believe it is obvious and would personally make the change.