Productions

EasyTagCloud

Easy to use, customized options, extended by plugins, this is EasyTagCloud.

3D Tags Plugin for EasyTagCloud

3D Tags Plugin Support 3d tags feature for EasyTagCloud.

Awesome Cloud Plugin for EasyTagCloud

Awesome Cloud build tags into nice looking shapes for EasyTagCloud.

Easy Seller

Easy Seller is an easy, reliable Joomla! extension to sell digital goods.

 
 
 
 
 
 
 

How to get rid of the session expire in Joomla. Joomla has added a function since 1.5 version to keep session alive while editing or creating articles,messages,managing media,etc.

The function lacated in libraries/joomla/html/html/behavior.php

If you want use the function to make your extension "keep alive",simply add

JHtml::_('behavior.keepalive');
 

at the beginning of the page.

See the code of the function of keepalive bellow:

/**
* Keep session alive, for example, while editing or creating an article.
*
* @return  void
* @since  1.5
*/
public static function keepalive()
{
static $loaded = false;
 
// only load once
if ($loaded) {
return;
}
 
// Include mootools framework
self::framework();
 
$config  = JFactory::getConfig();
$lifetime  = ($config->get('lifetime') * 60000);
$refreshTime = ($lifetime <= 60000) ? 30000 : $lifetime - 60000;
//refresh time is 1 minute less than the liftime assined in the configuration.php file
 
// the longest refresh period is one hour to prevent integer overflow.
if ($refreshTime > 3600000 || $refreshTime <= 0) {
$refreshTime = 3600000;
}
 
$document = JFactory::getDocument();
$script = '';
$script .= 'function keepAlive() {';
$script .= '  var myAjax = new Request({method: "get", url: "index.php"}).send();';
$script .= '}';
$script .=  ' window.addEvent("domready", function()';
$script .=  '{ keepAlive.periodical('.$refreshTime.'); }';
$script .= ');';
 
$document->addScriptDeclaration($script);
$loaded = true;
 
return;
}
 
 

Comments   

0 # Event manager 2013-08-21 07:16
Thanks for the coding you provided,it's a informative post,i really benefited,thank s
Here you can find joomla extensions :joomla calendar extensions
Reply | Reply with quote | Quote

Add comment


Security code
Refresh

Rating for us!

If you find our extensions userful, please rate for us in Joomla Extensions Dictionary, your rating and review will attract more users and improve the development.

Rate Now

Links

Contact

Mr. Qi Huang

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

Shenzhen City, Guangdong Province, China