I want to display the raw URL of my link field in my custom node.tpl.php.

I'm using this code but the URL it displays is that of the node and not what's in the field: print $node->content['field_download']['#value']; ">

Comments

DrupalKing’s picture

Anyone? Again, I just want to know how to manually output the raw URL in my node.tpl.php

jcfiala’s picture

Generally to get this sort of thing to display, you really just want to do a print on your $node and see how things are stored - often that's faster than asking for help here.

I don't remember the answer off of the top of my head, so I'll get back to you later, but print_r($node) or dpm($node) would probably be the fastest way to find it.

DrupalKing’s picture

I figured it out, so hopefully this helps someone:
print $node->field_download[0]['display_url']; ">

DrupalKing’s picture

Status: Active » Closed (fixed)
911’s picture

I have a node-mynodetype.tpl.php file and want to render the raw url of my link cck field. I tried this the whole day, but I cant get it to work.

I tried the code you post and I dont get it work too.

<?php
print $node->field_link[0]['display_url'];
?>
<?php
print $node->field_link[0]['url'];
?>
<?php
print $node->field_link[0]['value']['url'];
?>
<?php
print $item['value']['link'];
?>

Nothing works. The name of my cck field is link.

What am I doing wrong?

[EDIT]
Think I got it, it was related to drupals caching.

admin/settings/performance

clearing cache did it..