Miomir Dancevic
Miomir Dancevic

Reputation: 6852

Load your custom classes in MODx Revolution

I am trying to make some simple class in MODx but always getting 500 Server error, this ie example.

I created Plugin and call it on webPageinit

Plugin

class Foo {
    function HelloWorld() {
       echo 'Hello World';
    }
} 

And then created Snippet and try this

Snippet

$foo = new Foo; 

But I am getting internal server error 500, is this proper way to do this, or there is some autolader for your custom class?

Upvotes: 0

Views: 731

Answers (2)

Jako
Jako

Reputation: 857

If you want to use a class inside of MODX, you could load it by $modx->loadClass once. I won't use a plugin to load the class.

Upvotes: 0

goldsky
goldsky

Reputation: 831

I think this documentation can give you deeper explanation, especially about making custom back-end programming.

https://rtfm.modx.com/revolution/2.x/case-studies-and-tutorials/developing-an-extra-in-modx-revolution

Upvotes: 1

Related Questions