Page rendered correctly but display errors Page was rendered correctly but it display the following error message:

Strict warning: Only variables should be passed by reference in include() (line 31 of C:\xampp\htdocs\mysite\sites\all\themes\mytheme\templates\page.tpl.php).


I have a image field name field_header_image and I want to used the image as the header background image in my page.tpl.php. here is my code

&lt;div id="hero-container" class="hero-container" style="background:linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.35)), url('&lt;?php echo render(file_create_url($node-&gt;field_header_image['und'][0]['uri'])); ?&gt;');"&gt;


It display correctly and I can use the field image as my header background but it display the above error. Is there a better way to get rid of this error without using a module.
First of all, the 'und' is not prefered, you should use LANGUAGE_NONE constant instead. This is not part of the sollution, but part of the Drupal coding standards.

This is a tricky one. The function render() expects a string, but you give a part of an object with some deeper array keys.
The simplest way to get around the strict warning is to use the following code:

&lt;?php $uri = file_create_url($node-&gt;field_header_image[LANGUAGE_NONE][0]['uri']); ?&gt;
&lt;div id="hero-container" class="hero-container" style="background:linear-gradient(rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.35)), url('&lt;?php print render($uri); ?&gt;');"&gt;