<?php
define( '_JEXEC', 1 );
define( 'JPATH_BASE', realpath(dirname(__FILE__).'/mainpage' )); //mainpage is my joomla folder.
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();
$user =& JFactory::getUser();
$_SESSION['username'] = $user->get('name');
if ($user->get('guest') == 1) {echo"blabla";} else { echo "Hi ".$_SESSION['username']."! Welcome to our great website!";}
?>
This will result blabla in the browser, I actually want to have the 'Hi "MyName" Welcome to our great website!'. I create this file outside joomla folder.. the name of joomla folder is "mainpage". the $_SESSION['username'] is empty. I need to get current joomla username or name..
Please Help...
Thanks,
Leo
session_start();at the top of the script (after <?php but before the define)?