Support ⇒ Troubleshootings ⇒ BUG - class template.php ⇒ Community Forums ⇒ CPG Dragonfly™ CMS
Forum IndexTroubleshootings

BUG - class template.php Reply to topic


Hi,

I tried to create a new module for Dragonfly and found a problem. I could not have the templates inside the module, because the class template.php do not found them. Now that I have time, I have been researching and trying some things, I found a possible solution.
In the file includes/classes/template.php, I found the following problem. At line 196 on the latest version of the file (http://dragonflycms.org/cvs/html/includes/classes/template.php), we found the next code:
if (!file_exists(BASEDIR.$this->files[$handle]) && $pos = strpos($this->filename[$handle], '/') && is_dir(BASEDIR.'modules/'.substr($this->filename[$handle],0,$pos).'/template')) {
If the code runs, it gives an error about not finding the variable $pos (which is calculated in the central condition), the problem is that not being enclosed in parentheses, is not calculated properly.
The solution is to wrap this condition with a parenthesis like the following code:
if (!file_exists(BASEDIR.$this->files[$handle]) && ($pos = strpos($this->filename[$handle], '/')) && is_dir(BASEDIR.'modules/'.substr($this->filename[$handle],0,$pos).'/template')) {

I hope it is help to keep improving.

until the next (Bye),

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Dragonfly 9.2 (PHP5.4)


Thanks. Change added in code.google.com/p/drag...st?name=v9

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Fedora 25 / Apache 2.4.27 / MariaDB 10.1.26 / PHP 7.1.10 / Mercurial

All times are UTC


Jump to: