I want date a function datetime is refresh evrey 1 secondes to have exact time , so i hack a function datetime in system theme plugin and i put in my theme plugin.
Function :
Code
function smarty_function_date($params, &$smarty)
{
extract($params);
unset($params);
var ajaxCall;
$("runRequest").onclick = function() {
ajaxCall = new Ajax.PeriodicalUpdater($("format"),
"serveur/get-time.php", { method: "get", frequency: 1 });
}
// set some defaults
if (!isset($format)) {
$format = '_DATELONG';
}
if (strpos($format, '%') !== false) { // allow the use of conversion specifiers
return ml_ftime($format, (GetUserTime(time())));
}
return ml_ftime(constant($format), (GetUserTime(time())));
}
{
extract($params);
unset($params);
var ajaxCall;
$("runRequest").onclick = function() {
ajaxCall = new Ajax.PeriodicalUpdater($("format"),
"serveur/get-time.php", { method: "get", frequency: 1 });
}
// set some defaults
if (!isset($format)) {
$format = '_DATELONG';
}
if (strpos($format, '%') !== false) { // allow the use of conversion specifiers
return ml_ftime($format, (GetUserTime(time())));
}
return ml_ftime(constant($format), (GetUserTime(time())));
}
and on my theme template i put this :
Code
Time is show but it isn't update every 1 secondes. I am not so good in Ajax so if someone can help me to hack my function to works
