Jump to content

Featured Replies

Posted

Hello,

When I run this line: ($tab has the value of 'comments')

$record->commentReviews( $tab );

I get the following error:

  Quote

Only subclasses of Dispatcher can be instantiated

My guess is it throws the error when it hits this line in Records.php:

return \IPS\cms\Theme::i()->getTemplate( static::database()->template_display, 'cms', 'database' )->comments( $this );

Can't figure out why this is happening though. Am I missing a step? I do run init.php already beforehand.

Solved by Daniel F

Go to solution
  • Solution

It’s not enough to include the init.php , you also need to initialize the dispatcher . 

  • Author
 

It’s not enough to include the init.php , you also need to initialize the dispatcher . 

What's the way to do that?

Like so?

\IPS\Dispatcher\Front::i()->run()

 

If you are using a standalone script, use

\IPS\Dispatcher\External::i();

You don't need to call the run() method.

Recently Browsing 0

  • No registered users viewing this page.