Tom S. Posted June 27, 2020 Posted June 27, 2020 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.
Solution Daniel F Posted June 27, 2020 Solution Posted June 27, 2020 It’s not enough to include the init.php , you also need to initialize the dispatcher .
Tom S. Posted June 27, 2020 Author Posted June 27, 2020 22 minutes ago, Daniel F said: 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()
bfarber Posted June 29, 2020 Posted June 29, 2020 If you are using a standalone script, use \IPS\Dispatcher\External::i(); You don't need to call the run() method. Tom S. 1
Recommended Posts