Search code examples
phpjoomlajoomla-extensions

How to define JPATH_BASE in a plugin?


I want to access the joomla environment in my plugin and added these line of code (my source: http://www.diademblogs.com/content-management-systems/two-ways-to-add-joomla-users-using-your-custom-code):

 define( '_JEXEC', 1 );
 define('JPATH_BASE', dirname(__FILE__) );//this is when we are in the root
 define( 'DS', DIRECTORY_SEPARATOR );

 require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
 require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );

 $mainframe =& JFactory::getApplication('site');
 $mainframe->initialise();

But how can I ably define the JPATH_BASE variable, when I am programming a plugin (more specific: a authorisation plugin)?

I am using Joomla 1.7.


Solution

  • Your plugin is executed by joomla application. So you do not required to define, Just use them.