So, I've got a text field in my Drupal database. It's a raw URL string. I want to use that string to populate some custom whirlygig links on a custom node--contenttype_template.tpl.php. All I need is to print the raw data. Easy, right? Heh.
So naturally, I try print $field_name;
. Doesn't work.
So, I read some documentation. I try print render(content['field_name']);
. Nope.
I read more documentation. Call in the hubs. He sends me ideas that look like this:
print field_get_items('node', $node, 'field_source_website')[0]['safe_value'];
or
content['field_source_website'][0]['safe_value'];
or
$node->field_source_website->value()
This can not possibly be for real! All I want to do is print the data in the database!
So if I understand these sheets of data correctly, my options are to
- Convert my field to a Text Area, with a text formatter that converts links to HTML automatically and print that rendered content with no option for printing the text as a readable user friendly anchor
- Use some embarrassing backwards looking markup that looks like
print $node->content['field_name']['value']['0]]
or something to print out the raw data