Take the 2-minute tour ×
Joomla Stack Exchange is a question and answer site for Joomla! administrators, users, developers and designers. It's 100% free, no registration required.

As the title states, I'm interested in knowing what differences there are (if any) between JFactory::getSession() and $mainframe->getSession()

This question was inspired by Retrieve joomla session from within a module

If possible, I'd also like suggestions on how I could find out this information for myself in the future (please don't say google!)

share|improve this question

2 Answers 2

up vote 7 down vote accepted

The global variable $mainframe was remove in Joomla 1.6 and therefore will not work from that version onwards.

global $mainframe should be replaced with $mainframe = JFactory::getApplication(); but most people tend to use $app instead.

So you code should be like this:

$app = JFactory::getApplication();
$app->getSession();

Hope this helps

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.