johnmark Posted August 2, 2014 Share Posted August 2, 2014 PS version 1.6.0.8 Get "Unable to load template file" in Controller (i.e. AdminMTestConroller) for following code. class AdminMTestController extends ModuleAdminController { .. public function renderView() { if (version_compare(_PS_VERSION_, '1.5.6.0', '>')) $this->base_tpl_view = 'view_bt.tpl' ; return parent::renderView(); } .....} After several hours tracing, finally, the problem laid in classes\Tools.php public static function toUnderscoreCase($string) { // 'CMSCategories' => 'cms_categories' // 'RangePrice' => 'range_price' return Tools::strtolower(trim(preg_replace('/([A-Z][a-z])/', '_$1', $string), '_')); } It set the tpl_folder to "m_test" and resulting in customize template not found. Suggest to change it to http://stackoverflow.com/questions/1993721/how-to-convert-camelcase-to-camel-case public static function toUnderscoreCase($string) { // 'CMSCategories' => 'cms_categories' // 'RangePrice' => 'range_price' preg_match_all('!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!', $string, $matches); $ret = $matches[0]; foreach ($ret as &$match) { $match = $match == strtoupper($match) ? strtolower($match) : lcfirst($match); } return implode('_', $ret); } Hope it help others! Link to comment Share on other sites More sharing options...
marouane91 Posted August 3, 2014 Share Posted August 3, 2014 Thank you very much man, very considering of you mate, good job Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now