Can't find anything about this anywhere else:

Using PHP Template, when the page title and node title are the same (i.e., when viewing a specific node), you will end up with a duplicate title on the page. This can be seen here:

http://www.scottforcongress.com/new/?q=node/view/38

Obviously, that's not acceptable. ;) Unfortunately, page_title isn't passed through to the node template, so there's no way to check for duplication in order to omit the node title. I should be able to do this in node.tpl.php, but page_title isn't passed so there's no way to check it:

<?php if ($page_title != $title): 

print $title

endif;
?]

This is causing some real ugly display on some pretty high profile sites (see the one above), so a quick fix of some kind would be GREATLY appreciated.

Comments

seanr’s picture

This site has gone live _with the bug still occuring_. The live URL is here:

http://www.scottforcongress.com/?q=node/view/38

seanr’s picture

Fixed this by changing the title code to the following in node.tpl.php

if ((arg(0) == "node") && (arg(1) == "view")) { } else {
if ($node->type != "page"):

if ($page == 0): print $node_url " title=" print $title "> endif; print $title

endif;
}

seanr’s picture

Er, let's try that again:

<?php if ((arg(0) == "node") && (arg(1) == "view")) { } else { 

if ($node->type != "page"):

if ($page == 0): print $node_url " title=" print $title "> endif; print $title

endif;
}
?]

sgwealti’s picture

Project: » PHPTemplate
Version: » 4.6.x-1.x-dev

I'm having this problem too. Did it ever get fixed? I'm using Drupal 4.6.2 and the newest PHPtemplate theme engine with the Bluemarine theme.

mr700’s picture

Does the following code solve the problem for you as it does for me?

<?php if ($page == ''): /* $page : True if on the node view page, and not a summary. */ ?>
                <h1 class="title"><a href="<?php print($node_url); ?>"><?php print($title); ?></a></h1>
<?php endif; ?>

Maybe the check should simply be if (!$page), but I have to try it /I first 'debugged' it and then red the docs.../.

Moniek Paalvast’s picture

Hi mr700,

if ($page == '') and if (!$page) both solved the problem for me.

THX

morbus iff’s picture

Project: PHPTemplate » Drupal core
Version: 4.6.x-1.x-dev » x.y.z
Component: Code » theme system

PHPTemplate is part of core in 4.7. Moving.

greggles’s picture

Where does that set of lines go?

I'll make a patch if someone can point me in the right direction.

wulff’s picture

Status: Active » Fixed

This was fixed in revision 1.2 of node.tpl.php.

Anonymous’s picture

Status: Fixed » Closed (fixed)