Auto Refresh ?

Marik

Registered
Искам да попитам как може да се направи примерно като идеш на индекса на форума да се рефрешва :shock:
 
Пуцаш кода където и да из боди тага:

Код:
<script language="JavaScript">

//Refresh page script- By Brett Taylor (glutnix@yahoo.com.au)
//Modified by Dynamic Drive for NS4, NS6+
//Visit http://www.dynamicdrive.com for this script

//configure refresh interval (in seconds)
var countDownInterval=60;
//configure width of displayed text, in px (applicable only in NS4)
var c_reloadwidth=200

</script>


<ilayer id="c_reload" width=&{c_reloadwidth}; ><layer id="c_reload2" width=&{c_reloadwidth}; left=0 top=0></layer></ilayer>

<script>

var countDownTime=countDownInterval+1;
function countDown(){
countDownTime--;
if (countDownTime <=0){
countDownTime=countDownInterval;
clearTimeout(counter)
window.location.reload()
return
}
if (document.all) //if IE 4+
document.all.countDownText.innerText = countDownTime+" ";
else if (document.getElementById) //else if NS6+
document.getElementById("countDownText").innerHTML=countDownTime+" "
else if (document.layers){ //CHANGE TEXT BELOW TO YOUR OWN
document.c_reload.document.c_reload2.document.write('Next <a href="javascript:window.location.reload()">refresh</a> in <b id="countDownText">'+countDownTime+' </b> seconds')
document.c_reload.document.c_reload2.document.close()
}
counter=setTimeout("countDown()", 1000);
}

function startit(){
if (document.all||document.getElementById) //CHANGE TEXT BELOW TO YOUR OWN
document.write('Next <a href="javascript:window.location.reload()">refresh</a> in <b id="countDownText">'+countDownTime+' </b> seconds')
countDown()
}

if (document.all||document.getElementById)
startit()
else
window.onload=startit

</script>

БАЧКА ! ПРОБВАЛ СЪМ ГО и още си го ползвам ! :wink:
 
Форум мод за рефреш:

Код:
# 
#-----[ SQL ]------------------------------------------------ 
#
INSERT INTO `phpbb_config` VALUES ('refresh_time', '60');

#
#-----[ ОТВОРИ ]------------------------------------------------
#
index.php

#
#-----[ НАМЕРИ ]------------------------------------------------
#
// End session management
//

#
#-----[ СЛЕД ТОЗИ РЕД, ДОБАВИ ]-----------------------------------------
#
$refresh_time_enable = TRUE;

#
#-----[ ОТВОРИ ]------------------------------------------------
#
viewforum.php

#
#-----[ НАМЕРИ ]------------------------------------------------
#
// End session management
//

#
#-----[ СЛЕД ТОЗИ РЕД, ДОБАВИ ]-----------------------------------------
#
$refresh_time_enable = TRUE;

#
#-----[ ОТВОРИ ]------------------------------------------------
#
admin/admin_board.php

#
#-----[ НАМЕРИ ]------------------------------------------------
#
"L_ENABLE_PRUNE" => $lang['Enable_prune'],

#
#-----[ СЛЕД ТОЗИ РЕД, ДОБАВИ ]-----------------------------------------
#
"L_REFRESH_TIME" => $lang['Refresh_time'], 
"L_REFRESH_TIME_EXPLAIN" => $lang['Refresh_time_explain'],

#
#-----[ НАМЕРИ ]------------------------------------------------
#
"PRUNE_NO" => $prune_no, 

#
#-----[ СЛЕД ТОЗИ РЕД, ДОБАВИ ]-----------------------------------------
#

"REFRESH_TIME" => $new['refresh_time'],

#
#-----[ ОТВОРИ ]------------------------------------------------
#
includes/page_header.php

#
#-----[ НАМЕРИ ]------------------------------------------------
#
//
// Get basic (usernames + totals) online

#
#-----[ ПРЕДИ ТОЗИ РЕД, ДОБАВИ ]-----------------------------------------
#

if ($refresh_time_enable)
{
$refresh_time = $board_config['refresh_time'];
} else {
$refresh_time = -1;
}

if ( $refresh_time > 1 )
{
$template->assign_block_vars('switch_auto_refresh_on',array() );
}

#
#-----[ НАМЕРИ ]------------------------------------------------
#
'PRIVMSG_IMG' => $icon_pm,

# 
#-----[ СЛЕД ТОЗИ РЕД, ДОБАВИ ]-----------------------------------------
#

'REFRESH_TIME' => $refresh_time,

#
#-----[ ОТВОРИ ]------------------------------------------------
#
language/lang_english/lang_admin.php

#
#-----[ НАМЕРИ ]------------------------------------------------
#
$lang['Enable_prune'] = 'Enable Forum Pruning';

#
#-----[ СЛЕД ТОЗИ РЕД, ДОБАВИ ]-----------------------------------------
#
$lang['Refresh_time'] = 'Auto-Refresh Time (seconds)';
$lang['Refresh_time_explain'] = 'This will cause the page to automatically refresh so users can see new posts/information. If anything smaller than 1 is entered, the MOD will be disabled.';

#
#-----[ ОТВОРИ ]------------------------------------------------
#
templates/subSilver/overall_header.tpl

#
#-----[ НАМЕРИ ]------------------------------------------------
#
</head>

#
#-----[ ПРЕДИ ТОЗИ РЕД, ДОБАВИ ]-----------------------------------------
#

<noscript>
<meta http-equiv="refresh" content="{REFRESH_TIME}">
</noscript>

<script language="JavaScript">

</script>


#
#-----[ ОТВОРИ ]-----------------------------------------
#
templates/subSilver/admin/board_config_body.tpl

#
#-----[ НАМЕРИ ]------------------------------------------------
#
<tr>
<td class="row1">{L_ENABLE_PRUNE}</td>
<td class="row2"><input type="radio" name="prune_enable" value="1" {PRUNE_YES} /> {L_YES}  <input type="radio" name="prune_enable" value="0" {PRUNE_NO} /> {L_NO}</td>
</tr>

#
#-----[ ПРЕДИ ТОЗИ РЕД, ДОБАВИ ]-----------------------------------------
#
<tr>
<td class="row1">{L_REFRESH_TIME}<br /><span class="gensmall">{L_REFRESH_TIME_EXPLAIN}</span></td>
<td class="row2"><input class="post" type="text" name="refresh_time" size="4" maxlength="4" value="{REFRESH_TIME}" /></td>
</tr>

#
#-----[ SAVE И ЗАТВОРИ ВСИЧКИ ФАЙЛОВЕ ]--------------------------------
#

оригинал: http://web-tourist.net/login/login/view.php?st=818

:wink:
 

Back
Горе