<?php
define( 'DS', DIRECTORY_SEPARATOR );
$rootFolder = explode(DS,dirname(__FILE__));
//current level in directory structure
//example : (components/com_banner/view/tpl/ >>> $currentfolderlevel = 4;)
array_splice($rootFolder,-$currentfolderlevel);
$base_folder = implode(DS,$rootFolder);
if(is_dir($base_folder.DS.'libraries'.DS.'joomla'))
{
define( '_JEXEC', 1 );
define(JPATH_BASE,implode(DS,$rootFolder));
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$userid='';
$usertype='';
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
$user =& JFactory::getUser();
$userid = $user->get('id');
$usertype = $user->get('usertype');
}
?>
define( 'DS', DIRECTORY_SEPARATOR );
$rootFolder = explode(DS,dirname(__FILE__));
//current level in directory structure
//example : (components/com_banner/view/tpl/ >>> $currentfolderlevel = 4;)
$currentfolderlevel = 4;
array_splice($rootFolder,-$currentfolderlevel);
$base_folder = implode(DS,$rootFolder);
if(is_dir($base_folder.DS.'libraries'.DS.'joomla'))
{
define( '_JEXEC', 1 );
define(JPATH_BASE,implode(DS,$rootFolder));
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$userid='';
$usertype='';
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
$user =& JFactory::getUser();
$userid = $user->get('id');
$usertype = $user->get('usertype');
}
?>
No comments:
Post a Comment