Monday, 08 July 2013 22:47

how to use session in joomla

Written by 
Rate this item
(0 votes)

session is a essential part of joomla. It's main use
is for remembering user login, also there are many
usage of it.

1. how to store data in session? see below -

$msfbwall_user_session = JFactory::getSession(); // main call

here i saved current menu item id in a session variable "msfb_session_itemid"

2. how to check session var exists and get stored value ? see here -

if(($msfbwall_user_session->get('msfb_session_itemid')!=NULL)) //session not null
$msfb_mod= $msfbwall_user_session->get('msfb_session_itemid');

3. how to destroy a stored session value ? this way -


this will remove the value stored in session variable "msfb_session_itemid"

hope it helps a lot.Dont forget to like and share it.

Read 3244 times Last modified on Monday, 08 July 2013 22:54
Super User

Email This email address is being protected from spambots. You need JavaScript enabled to view it.

Latest discussions

  • No posts to display.