e.g. if it is located in a subfolder: custom/myscripts/ then use:
Code:
<?php
// *********************
// Load Joomla framework
// *********************
define( '_JEXEC', 1 );
define( '_VALID_MOS', 1 );
define( 'JPATH_BASE', realpath(dirname(__FILE__)) );
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$app = JFactory::getApplication('site');
$app->initialise();
// Define component paths
define( 'JPATH_COMPONENT_SITE', JPATH_SITE.DS.'components'.DS.'com_flexicontent' );
define( 'JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR.DS.'components'.DS.'com_flexicontent' );
// Create a log file
$log_filename = 'item_creation_'.($user->id).'.php';
jimport('joomla.log.log');
JLog::addLogger(array('text_file' => $log_filename));
// **************************************
// Include the needed classes and helpers
// **************************************
require_once (JPATH_COMPONENT_SITE.DS.'classes'.DS.'flexicontent.helper.php');
require_once (JPATH_COMPONENT_SITE.DS.'classes'.DS.'flexicontent.categories.php');
require_once (JPATH_COMPONENT_SITE.DS.'classes'.DS.'flexicontent.fields.php');
require_once (JPATH_COMPONENT_SITE.DS.'classes'.DS.'flexicontent.acl.php');
require_once (JPATH_COMPONENT_SITE.DS.'helpers'.DS.'permission.php');
require_once (JPATH_COMPONENT_SITE.DS.'helpers'.DS.'route.php');
// Add component's table directory to the include path
JTable::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR.DS.'tables');
// *******************
// Load language files
// *******************
// (BACKEND) Load english language file for 'com_content' component then override with current language file
JFactory::getLanguage()->load('com_content', JPATH_ADMINISTRATOR, 'en-GB', true);
JFactory::getLanguage()->load('com_content', JPATH_ADMINISTRATOR, null, true);
// (BACKEND) Load english language file for 'com_flexicontent' component then override with current language file
JFactory::getLanguage()->load('com_flexicontent', JPATH_ADMINISTRATOR, 'en-GB', true);
JFactory::getLanguage()->load('com_flexicontent', JPATH_ADMINISTRATOR, null, true);
// (FRONTEND) Load english language file for 'com_content' component then override with current language file
JFactory::getLanguage()->load('com_content', JPATH_SITE, 'en-GB', true);
JFactory::getLanguage()->load('com_content', JPATH_SITE, null, true);
// (FRONTEND) Load english language file for 'com_flexicontent' component then override with current language file
JFactory::getLanguage()->load('com_flexicontent', JPATH_SITE, 'en-GB', true);
JFactory::getLanguage()->load('com_flexicontent', JPATH_SITE, null, true);
// ****************************
// Create the item model object
// ****************************
require_once(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_flexicontent'.DS.'models'.DS.'item.php');
$item_model = new FlexicontentModelItem();