Module template override

5 years 7 months ago - 5 years 7 months ago #1 by Thomas
Module template override was created by Thomas
Hello,

I bought today Yours NS Pro - hope it will serve me well. :D Now, I was trying to override the module template and saw something like this in the mod_nspro.php
include(JPATH_SITE.'/components/com_nspro/views/nspro/tmpl/default.php');
but if You write it like this then the module won't look for the template override. I don't know (yet) what's the proper way of searching for overrides in Joomla, but I wrote it like this
somewhere eariler
$doc = JFactory::getDocument();
    $app = JFactory::getApplication();
if( file_exists(JPATH_SITE.'/templates/' . $app->getTemplate() . '/html/nspro/default.php') && is_readable(JPATH_SITE.'/templates/' . $app->getTemplate() . '/html/nspro/default.php') && include(JPATH_SITE.'/templates/' . $app->getTemplate() . '/html/nspro/default.php')){
    }
    else {
      include(JPATH_SITE.'/components/com_nspro/views/nspro/tmpl/default.php');  
    }
and it works like a charm. I think You should implement something like this. :)

Sincerely,
Thomas

Please Log in or Create an account to join the conversation.

Moderators: Christopher Mavros