Joomla: $this->baseurl is not working in custom template module

February 26, 2011 | In: Joomla, php, web development

Joomla provides some basic themes which are already installed in the templates folder. When any developer develop the CMS in the joomla , he use his own template with new design.
On the index page


works well but when he want to own module then he create a folder in custom template folder.
But in that module folder


doesn’t work. Why? because joomla does not provide to access $this in the custom module folder.

You should replace below code

<img src="<?php echo $this->baseurl; ?>/templates/CUSTOM_TEMPLATE_NAME/images/xyz.jpg" alt="" />


<img src="<?php echo JURI::base(); ?>/templates/CUSTOM_TEMPLATE_NAME/images/xyz.jpg" alt="" />