How to use sessions in Joomla! 1.5 using the Joomla! API

Written by Ian Carnaghan · 19 sec read >
  • This can be obtained using the JFactory/getSession object
  • Instantiate the getSession object
    $session =& JFactory::getSession();

    There are a couple of parameters that you can pass with this object. They are

    • name – The session name
    • id – Unique ID of the session
    • expire – Expiry date and time
    • security – Comma separated security options, have a look at JSession
  • Now we set the session
    $session->set( 'mySession', 'sessionValue' );
  • We get the session variable as follows
    $session->get( 'mySession' );

NOTE: For more information refer to the Joomla! API documentation.

Last Updated On March 30, 2018
Written by Ian Carnaghan
I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment. In my spare time I teach undergraduate classes in web development. Profile

Leave a Reply

Notify of