Print full node url escaping special characters? How can I print the full node url in a tpl file escaping special characters? 

So im using this:

&lt;?php print $base_url . $node_url ?&gt;


Which gives me a url like http://time.com/3525666/ebola-psychology-fear-symptoms/

However I need the url to be like http%3A%2F%2Ftime.com%2F3525666%2Febola-psychology-fear-symptoms%2F
The proper way to generate a URL is with the url() function, and the absolute option:

$absolute_url = url('node/123', array('absolute' =&gt; TRUE));


You then need to encode it:

$encoded_url = rawurlencode($absolute_url);


This work should be done in a preprocess function, and the variable added to $variables, and not done in the .tpl.php file directly:

function MYTHEME_preprocess_node(&amp;$variables) {
  $absolute_url = url('node/123', array('absolute' =&gt; TRUE));
  $encoded_url = rawurlencode($absolute_url);

  $variables['encoded_url'] = $encoded_url;
}


and then printed in the template.

&lt;?php print $encoded_url ?&gt;


However, you more than likely want to use the query option or drupal_http_build_query  for whatever you are trying to use this for.  What you are describing typically isn't needed directly.  Giving the proper advice, though, is a little hard without more context.