I want to use a class from another file within my custom position, in best case using JLoader - can i do that?
I have a content type "strain" with overwrite position on mainbody. In this mainbody.php file i want to use code like this:
JLoader::register('JLoaderTest', JPATH_BASE . '/templates/seb_one/positions/strain/content/test.php');
I've had a really hard time even understanding the documentation, but now it should bring in all the functions of the test.php file - right...?
This is the content of the test.php file: <?php JLoaderTest {
public function helloWorld() {
echo 'hello world';
}
}
Why is all i get "0 Call to undefined function helloWorld()", when i try to call the function in my mainbody.php file...?
EDIT: GOT IT! I tried to use the function directly, but i had to initialize the class first with something like this: $classvar = NEW JLoaderTest();
They really could do a better documentation with examples and stuff -.-