API16:JHtmlBehavior/keepalive
From Joomla! Documentation
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.
Contents |
Description
Keep session alive, for example, while editing or creating an article.
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax
static keepalive()
Defined in
libraries/joomla/html/html/behavior.php
Importing
jimport( 'joomla.html.html.behavior' );
Source Body
public static function keepalive() { // Include mootools framework JHtmlBehavior::mootools(); $config = &JFactory::getConfig(); $lifetime = ($config->getValue('lifetime') * 60000); $refreshTime = ($lifetime <= 60000) ? 30000 : $lifetime - 60000; //refresh time is 1 minute less than the liftime assined in the configuration.php file $document = &JFactory::getDocument(); $script = ''; $script .= 'function keepAlive() {'; $script .= ' var myAjax = new Ajax("index.php", { method: "get" }).request();'; $script .= '}'; $script .= ' window.addEvent("domready", function()'; $script .= '{ keepAlive.periodical('.$refreshTime.'); }'; $script .= ');'; $document->addScriptDeclaration($script); return; }
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
<CodeExamplesForm />
