Since I couldn't find a solution in the forums, I'll try it here -- I hope that's ok.

I am using Zen 5.x-1.1 and I'm looking for a way to print node content (in my case: a CCK field) above the title in full node view. Since the title comes from page.tpl.php, I can't print any node content above it changing node.tpl.php. But neither can I print variables from $node in page.tpl.php. One idea is to delete the line

<?php if ($title): ?>
  <h1 class="title"><?php print $title; ?></h1>
<?php endif; ?>

from my page.tpl.php and add it to my node.tpl.php but that would lead to pages without titles -- those that are not processed through node.tpl.php. So I tried the following in page.tpl.php:

<?php if (!$page): ?>
  <?php if ($title): ?>
    <h1 class="title"><?php print $title; ?></h1>
  <?php endif; ?>
<?php endif; ?>

and something like this in node.tpl.php:

<?php if ($page): ?>
  <?php if ($title): ?>
    <h1 class="title"><?php print $title; ?></h1>
  <?php endif; ?>
<?php endif; ?>

But that doesn't work because $page in page.tpl.php seems to always have the same value.

Could anyone help me to accomplish what I need? Or tell me what I'm doing wrong?

Comments

yan’s picture

One solution I found here is to use arg() for the if-statement:

In node.tpl.php:

<?php if (arg(0) == 'node' AND $title): ?>
  <h1 class="title"><?php print $title; ?></h1>
<?php endif; ?>

In page.tpl.php:

<?php if (arg(0) != 'node' AND $title): ?>
  <h1 class="title"><?php print $title; ?></h1>
<?php endif; ?>

In the comment I found it in, the use of arg(1) is mentioned. That doesn't work for me. I guess that'd be necessary for multi-language sites that have the language code as first argument.

Note to self: Check why I always find a solution right after posting my question.

demenece’s picture

Hi yan! any idea how can i translate this to a node-list view, like the term-page on taxonomies? i've this for now: http://www.demenece.com.ar/drupal-5.7/taxonomy/term/6 , i'm using Zen and i want the title to be desplayed between content and links (that means in this case between the image and the links)

yan’s picture

The title in teaser list is printed in your node.tpl.php:

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

So I guess by placing the image above the title and not showing it in the teaser should do it. I don't know which method you use for your images, so I can't really tell you what you'd have to put.

akalata’s picture

Status: Active » Fixed
akalata’s picture

Status: Fixed » Closed (fixed)