Difference between revisions of "JHtmlBehavior/keepalive"
From Joomla! Documentation
< API16:JHtmlBehavior
(New page: ===Description===
Keep session alive, for example, while editing or creating an article.
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JHtmlBehavi...) |
m (removing red link to edit, no existant pages) |
||
Line 3: | Line 3: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Syntax=== | ===Syntax=== | ||
Line 45: | Line 45: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Examples=== | ===Examples=== | ||
Line 60: | Line 60: | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
+ | [[Category:Archived pages API16]] |
Revision as of 21:56, 13 May 2013
The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
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[edit]
static keepalive()
Defined in[edit]
libraries/joomla/html/html/behavior.php
Importing[edit]
jimport( 'joomla.html.html.behavior' );
Source Body[edit]
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[edit]
<CodeExamplesForm />