I've created a custom content type for URLs and want to have the title when listing nodes (such as with taxonomy or on the front page) to link to the site rather than to the node itself. Is this possible through the theming mechanism and how can it be done?

Comments

Mirrorball’s picture

Yes, see node.tpl.php. In bluemarine, this would be:

  <div class="node<?php if ($sticky) { print " sticky"; } ?><?php if (!$status) { print " node-unpublished"; } ?>">
    <?php if ($picture) {
      print $picture;
    }?>
    <?php if ($page == 0) { ?><h2 class="title">
    <?php if ($type == 'your custom type') { ?><a href="<?php print $base_path ?>"><?php print $title?></a>
    <?php } else { ?><a href="<?php print $node_url?>"><?php print $title?></a><?php }; ?>
    </h2><?php }; ?>
    <span class="submitted"><?php print $submitted?></span>
    <span class="taxonomy"><?php print $terms?></span>
    <div class="content"><?php print $content?></div>
    <?php if ($links) { ?><div class="links">&raquo; <?php print $links?></div><?php }; ?>
  </div>
ninetwenty’s picture

Thanks for that Mirrorball. I also just found some info tucked away on creating node-type.tpl.php so it can go in a seperate file. http://drupal.org/node/17565