Jump to content

/system/Theme/Dev/Template.php __call() method


gudman

Recommended Posts

Hello, Dear colleagues,

In file /system/Theme/Dev/Template.php (line 88) (version 4.1.18.2) may be more informative \BadMethodCallException message is:

throw new \BadMethodCallException( 'NO_TEMPLATE_FILE - ' . $file . '; BIT - ' . $bit );

Very hard to debug with message:
 

Quote

 

NO_TEMPLATE_FILE -

 

:)

Thank you.

Link to comment
Share on other sites

7 hours ago, GriefCode said:

Hey,

not sure if i can follow you as it is working fine for me:
1.thumb.PNG.3600cc0776582e4e37b1cfa9593d8dd3.PNG

 

BTW. Determining the file itself can be easy as we have this wonderful debug view:
2.thumb.PNG.9d6d4be6e1a8f002e2db819188de53e1.PNG

Just find the call and It will directly display the controller row.

 

Greetings

Dear friend,

you are right but in common case. Let's see the code:

            /* Find the file */
            $file = NULL;
            if ( $this->sourceFolder === \IPS\ROOT_PATH . '/plugins' )
            {
                foreach ( new \GlobIterator( $this->sourceFolder . '/*/dev/html/' . $bit . '.phtml' ) as $file )
                {
                    break;
                }
            }
            else
            {
                $file = $this->sourceFolder . $bit . '.phtml';
            }
            
            /* Get the content */
            if ( $file === NULL or !file_exists( $file ) )
            {
                throw new \BadMethodCallException( 'NO_TEMPLATE_FILE - ' . $file );
            }

=> if in foreach we won't file $file => variable $file is NULL. And we get not informative error message. :(

Link to comment
Share on other sites

5 minutes ago, gudman said:

=> if in foreach we won't file $file => variable $file is NULL. And we get not informative error message. :(

Indeed, you are right. It could be enhanced by adding the bit also as output ;) 

Not a big deal on both sides, adding it or not as it is more like "a nice to have", you can still find the call of a wrong/missing template with the debug tool.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...