Changing $template for $app->getTemplate() J!3 Compatible

This change is needed, because some extensions are getting errors when using T3V3, so, in order to avoid such errors, it is best to use new Joomla 3.0 methods