I've created a content type with some fields like link
, address
. And I did content-type node theming with name node--machine-name.tpl.php and all fields are printed by this code
<?php print render($content['content']); ?>
or individual fields like this
<?php print render($content['field_link_url']); ?>
<?php print render($content['body']); ?>
But I want to save the link field in a variable, which will be used in various ways.
I just want this field_link_url field to not be printed but to be stored in a variable
What I Tried
- echo $link = $field_link_url['und'][0]['value'];
- echo $link = $content['field_link_url']['und'][0]['value'];
Apart from that I got the message with all the array fields with this
`drupal_set_message("<pre>". print_r($node,true) . "</pre>");`
which gave me this..
stdClass Object
(
[vid] => 51
[uid] => 1
[title] => Run Tests on the Cloud. No Software or Hardware Required!
[log] =>
[status] => 1
[comment] => 1
[promote] => 0
[sticky] => 0
[nid] => 51
[type] => landing_pages
[language] => und
[created] => 1392994690
[changed] => 1393072611
[tnid] => 0
[translate] => 0
[revision_timestamp] => 1393072611
[revision_uid] => 1
[body] => Array
(
[und] => Array
(
[0] => Array
(
[value] =>
No software or hardware to buy or maintain.
[summary] =>
[format] => full_html
[safe_value] =>
No software or hardware to buy or maintain.
[safe_summary] =>
)
)
)
[field_link_title] => Array
(
[und] => Array
(
[0] => Array
(
[value] => START A FREE TRAIL
[format] =>
[safe_value] => START A FREE TRAIL
)
)
)
[field_link_url] => Array
(
[und] => Array
(
[0] => Array
(
[value] => http://xyz.displaybox.in/why-xyz/easy-to-manage-your-tests
[format] =>
[safe_value] => http://xyz.displaybox.in/why-xyz/easy-to-manage-your-tests
)
)
)