Pages

Saturday, September 10, 2011

Joomla! 1.5: Accessing a Model of a Component from a Module/Plugin or anywhere

JLoader::import('joomla.application.component.model');

JLoader::import( 'investment', JPATH_SITE . DS . 'components' . DS . 'com_<COMPONENT-NAME>' . DS . 'models' );

$model =& JModel::getInstance('<MODEL-CLASS-NAME>');

A blog commenter told the 2 line is not required but I can not make this working without the 2nd line.

It is also notable, that blog was using JPATH_ADMINISTRATOR, and mine was JPATH_SITE.

No comments :

Post a Comment