Question

What is the way to call components model method in a joomla module. I know there is a helper file inside of custom module and that should do the job, but how they do that?

Was it helpful?

Solution

It doesn't matter if you do it in the helper file or in the main file. The helper file is just a nice place to stuff away this kind of code :)

To call the model you need to include it first since it's not autoloaded. That means usually using something like require_once('components/com_content/models/article'). After that you can instantiate the class with $class = new ContentModelArticle and call the method $item = $class->getItem(). That should at least work in theory :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top