Why writing this simple plugin, I have some confusions:-
1. Should I use $modx-> or $this-> in a plugin?
2. Should I use $this->sendErrorPage(); or
$this->documentMethod = ’id’;
$this->documentIdentifier = $this->config[’error_page’];
-
☆ A M B ☆
- 24,524 Posts
Use $modx->
$this-> is only used inside the MODx parser class itself. Outside, you are using an object named $modx which gets instantiated by index.php. If you are loading the parser into an external script, you need to instantiate the object yourself.
This issue has been also discussed
here and there is some fix attached to that thread. But it seems that the issue is not still fully resolved. If there’s not a bug report for this yet, would you mind creating one?
"He can have a lollipop any time he wants to. That's what it means to be a programmer."