I have created a view which displays the 10 latest news items (articles). They show up fine in teaser format. When clicking on the full article there is no title displayed and I can't work out why. This is my node--article.tpl.php:

<div class="article">
  <div id="node-<?php print $node->nid; ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>
    <div class="postheader">
        <?php print $user_picture; ?>

        <?php print render($title_prefix); ?>
        <?php if (!$page): ?>
        <h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
        <?php endif; ?>
        <?php print render($title_suffix); ?>

        <?php print render($title_suffix); ?>

        <?php if ($unpublished): ?>
            <div class="unpublished">
                <?php print t('Unpublished'); ?>
        <?php endif; ?>

        <?php if ($display_submitted): ?>
        <div class="postinfo">
            <?php print $user_picture; ?> <!-- print the user picture, do not move if you want the picture displaying on the top -->
                print t('!username • !date • !time',
                array('!username' => $name, '!date' => date( "d/m/y",$node->created), '!time' => date( "G:i",$node->created)));
        <?php endif; ?>
    <div class="content"<?php print $content_attributes; ?>>
            // We hide the comments and links now so that we can render them later.
            print render($content);
        <div class="links">
            <?php print render($content['links']); ?>   
    <?php print render($content['comments']); ?>

Also I should note that I'm very new to drupal and I don't know PHP very well. If anyone could tell my why that would be really helpful. Thanks.

  • Are you using Panels? Do you have a panel variant set for articles? – Jay Mar 3 '12 at 12:58
  • No, I'm not using panels. – Theo Mar 3 '12 at 13:15

Your template is expecting that the node title will be displayed as the page title, which in controlled in the page.tpl.php. Either the title is printed, but not where you expect or you don't print the page titles at all.

  • I don't think it's printing the titles as it's not in the source of the page. How do I get it to print the title? – Theo Mar 3 '12 at 16:23
  • Something like <h1 class="page-title"><?php print $title ?></h1> should do the trick – googletorp Mar 3 '12 at 18:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.