Content Type Field value in variable 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

&lt;?php print render($content['content']); ?&gt; 


or individual fields like this

&lt;?php print render($content['field_link_url']); ?&gt; 
&lt;?php print render($content['body']); ?&gt; 


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("&lt;pre&gt;". print_r($node,true) . "&lt;/pre&gt;");`


which gave me this..

stdClass Object
(
[vid] =&gt; 51
[uid] =&gt; 1
[title] =&gt; Run Tests on the Cloud. No Software or Hardware Required!
[log] =&gt; 
[status] =&gt; 1
[comment] =&gt; 1
[promote] =&gt; 0
[sticky] =&gt; 0
[nid] =&gt; 51
[type] =&gt; landing_pages
[language] =&gt; und
[created] =&gt; 1392994690
[changed] =&gt; 1393072611
[tnid] =&gt; 0
[translate] =&gt; 0
[revision_timestamp] =&gt; 1393072611
[revision_uid] =&gt; 1
[body] =&gt; Array
    (
        [und] =&gt; Array
            (
                [0] =&gt; Array
                    (
                        [value] =&gt; 
                            No software or hardware to buy or maintain. 
                        [summary] =&gt; 
                        [format] =&gt; full_html
                        [safe_value] =&gt; 
                            No software or hardware to buy or maintain.


                        [safe_summary] =&gt; 
                    )

            )

    )


[field_link_title] =&gt; Array
    (
        [und] =&gt; Array
            (
                [0] =&gt; Array
                    (
                        [value] =&gt; START A FREE TRAIL
                        [format] =&gt; 
                        [safe_value] =&gt; START A FREE TRAIL
                    )

            )

    )

[field_link_url] =&gt; Array
    (
        [und] =&gt; Array
            (
                [0] =&gt; Array
                    (
                        [value] =&gt; http://xyz.displaybox.in/why-xyz/easy-to-manage-your-tests
                        [format] =&gt; 
                        [safe_value] =&gt;  http://xyz.displaybox.in/why-xyz/easy-to-manage-your-tests
                    )

            )

    )
echo $link = $content['field_link_url']['und'][0]['value'];


This way must be correct!
Check *field_link_url* key in content variable with dsm or kpr fucntion.

And try to get *field_link_url* value from this key.