I'm trying to use CCK to put a link into the title field of my page. I want it to add a link if there is a value in the url field and if there isn't use the node title.

I've found this code here that sort of works but I'm fairly new to PHP:

if (content_format('field_url', $field_url[0])) print content_format('field_url', $field_url[0]); else print $node_url; ">
print $title;

Found at: http://drupal.org/node/245942

Comments

Breen’s picture

Oops made a mistake in pasting the code:

  <h2 class="title"><a href="
<?php if (content_format('field_url', $field_url[0])) print content_format('field_url', $field_url[0]); else print $node_url; ?>">
<?php print $title; ?>
</a></h2>
summit’s picture

Subscribing, please explain how to make the node-title containing html like href.
greetings,
Martijn