Hello,

The node's title gets to display twice, one is with

tag and hyper-link while 2nd one is the
without the hyper-link title.
After some digging into the codes of node.tpl.php in the template folder, I found out that it could be a missing if else statement.

Here is what I do:
Change these lines:

<h2 class="title"><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
<?php endif; ?>

<h1 class="title"><?php print $title; ?></h1>

To:

<?php if ($page == 0): ?>
<h2 class="title"><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
<?php else: ?>
<h1 class="title"><?php print $title; ?></h1>
<?php endif; ?>

Then the
title field will disappear from the front page view and the teaser view while the link to the node will stay.
Don't know if I am doing it correctly though.

Leon

CommentFileSizeAuthor
#2 missingelse.patch542 bytesvisum
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

leon85321’s picture

errr I forgot to remove the < and > from the h1 and h2 in the above post... should have click preview first lol

The node's title gets to display twice, one is with h2 tag and hyper-link while 2nd one is the h1 tag without the hyper-link title.
After some digging into the codes of node.tpl.php in the template folder, I found out that it could be a missing if else statement.

Here is what I do:
Change these lines:

<h2 class="title"><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
<?php endif; ?>

<h1 class="title"><?php print $title; ?></h1>

To:

<?php if ($page == 0): ?>
<h2 class="title"><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
<?php else: ?>
<h1 class="title"><?php print $title; ?></h1>
<?php endif; ?>

Then the h1 tagged title field will disappear from the front page view and the teaser view while the links with h2 tag to the node will stay.
Don't know if I am doing it correctly though.

Leon

visum’s picture

FileSize
542 bytes

I came to the same conclusion. Here's a patch.

koldtoft’s picture

I removed the 2nd title using the code from leon85321 example, but now I have a high empty space between the clickable title and the body content.

Any hints on how to remove this space and place the title, right above the content?

Skelly1983’s picture

i removed the h1 tag in the teaser and its txt by using:

<?php $str = preg_replace('#(<h1.*?>).*?(</h1>)#', '$1$2', $rows); echo strip_tags($str, '<a> <div> <p> <h2> <h3> <?php> <span> <img> <strong> <em> <table> <td> <tr> <th> <tbody> <center> <ul> <li> <ol> <font> <blockquote> <br> <fieldset> <input> <textarea> <tfoot> <thead> <button> <form> <h4> <h5> <h6> <label> <pre> <select> <sub> <sup> <tt>'); ?>

the $rows string is for views teasers, the 2nd part of the strip_tags is all the tags i want to keep in my teasers just incase i use them all other tags will be taken out so if u dont want some of them just remove them from the code and they will be striped out aswell.

i know there is prob an easier or better way to do this but works perfectly fine with no side efects. i placed this in my custom theme's views-view--NODENAME.tlp.php file which i had created and just replaced:

print $rows;

i use artisteer aswell, and there is no reuirment to add this extra code to template.php

Guru’s picture

Status: Active » Needs review
Issue tags: +theme, +Drupal 6.x, +Celadon

#1 by leon85321 works perfectly. Thanks to visum for creating a patch out of it.

1100Broadway’s picture

Works perfectly! Thanks Leon.

maulwuff’s picture

Status: Needs review » Reviewed & tested by the community

works great.
also needed for taxonomy list pages.

rot3r1’s picture

working fine thanks!