Change print $node_url To a Link Fields Value Hello i would like to change the destination of a url in a node.tpl (in a view) from this-

&lt;a href="&lt;?php print $node_url; ?&gt;"&gt;


to something like this-

&lt;a href="[field_viewslink]"&gt;


where the field viewslink is a link field in the node itself.

I know i could do it if the view used fields but it doesnt its using a content teaser.

Anyone got any advice?

Thanks

sites/all/themes/other_sub/templates/nodes/node--view--portfolio-block.tpl.php

&lt;li class="&lt;?php print str_replace(',-', ' ', str_replace(' ', '-',strip_tags(render($content['field_portfolio_category'])))); ?&gt;"&gt;
    &lt;?php print render($content['field_portfolio_image']); ?&gt;
    &lt;div&gt;
        &lt;a href="&lt;?php print render($content['field_viewslink']); ?&gt;"&gt;
          &lt;span class="center"&gt;
              &lt;h4 class="heavy remove-bottom"&gt;&lt;?php print $title; ?&gt;&lt;/h4&gt;
              &lt;p&gt;&lt;?php print strtolower(render($content['field_portfolio_category'])); ?&gt;&lt;/p&gt;
          &lt;/span&gt;
        &lt;/a&gt;
    &lt;/div&gt;
&lt;/li&gt;
If it is a field with in the node then you should be able to use the $node object. 

The object contains all the fields associated with the node. 

if you are not sure of the name of the field then you could try to print the object using the print_r function. 

You could also try try the $content object which contains the fields as well. 

print render($content['field_viewslink']);


That should render the variable.