本文整理汇总了PHP中JHtmlBehavior::mootools方法的典型用法代码示例。如果您正苦于以下问题:PHP JHtmlBehavior::mootools方法的具体用法?PHP JHtmlBehavior::mootools怎么用?PHP JHtmlBehavior::mootools使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JHtmlBehavior
的用法示例。
在下文中一共展示了JHtmlBehavior::mootools方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: keepalive
/**
* Keep session alive, for example, while editing or creating an article.
*/
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;
}