https://discuz.dismall.com/viewthread.php?tid=1533939
安装说明
先把包里文件传到你UCHOME 根目录下
1、导入数据库:
CREATE TABLE `uchome_app_laba` (
`lid` mediumint(8) unsigned NOT NULL auto_increment,
`uid` mediumint(8) NOT NULL default '0',
`username` varchar(20) NOT NULL default '',
`dealy` tinyint(2) unsigned NOT NULL default '0',
`say` varchar(200) NOT NULL default '',
`act` varchar(10) NOT NULL default '',
`dateline` int(10) default '0',
PRIMARY KEY (`lid`)
) ENGINE=MyISAM DEFAULT CHARSET=gbk;
注意:数据库后缀:uchome_app_laba 如果你的数据库 有后缀uchome_数据库后缀名称app_laba
2、在common.php的最下边代码里添加:
//每页都有一个获取喇叭的函数
function get_laba(){
global $_SGLOBAL;
$cachefile = S_ROOT.'./data/cache_laba.txt';
if(!$_SGLOBAL['laba']){
if($_SGLOBAL['timestamp'] - @filemtime($cachefile)<60) {
$_SGLOBAL['laba'] = unserialize(sreadfile($cachefile));
}else{
$query = $_SGLOBAL['db']->query('SELECT * FROM '.tname('app_laba').' ORDER BY dateline DESC LIMIT 10');
while($value = $_SGLOBAL['db']->fetch_array($query)){
$_SGLOBAL['laba'][] = $value;
}
swritefile($cachefile, serialize($_SGLOBAL['laba']));
}
}
foreach($_SGLOBAL['laba'] as $key=>$value){
realname_set($value['uid'], $value['username']);//实名
$_SGLOBAL['laba'][$key] = $value;
}
return $_SGLOBAL['laba'];
}
//随机颜色
function get_rndcolor(){
$str = "0123456789abcdef";
$color = '#';
for($i=1;$i<7;$i++){
$color .= $str{intval(rand(0, 15))};
}
return $color;
}
3、打开template/default/space_feed.htm:
找到
<!--{if $isnewer && $task}-->
<div class="ye_r_t"><div class="ye_l_t"><div class="ye_r_b"><div class="ye_l_b">
<div class="task_notice">
<div class="task_notice_body">
<div class="notice">您好,{$_SN[$space[uid]]},欢迎加入我们。有新任务等着您,挺简单的,赶快来参加吧</div>
<img src="$task[image]" alt="" class="icon" />
<h3><a href="cp.php?ac=task&op=do&taskid=$task[taskid]">$task[name]</a></h3>
<p>可获得 <span class="num">$task[credit]</span> 积分</p>
</div>
</div>
</div></div></div></div><br>
<!--{/if}-->
<!--{if empty($_SCOOKIE['closefeedbox']) && $_SGLOBAL['ad']['feedbox']}-->
<div id="feed_box" class="ye_r_t"><div class="ye_l_t"><div class="ye_r_b"><div class="ye_l_b">
<div class="task_notice">
<a title="忽略" class="float_cancel" href="javascript:;" onclick="close_feedbox();">忽略</a>
<div class="task_notice_body">
<!--{ad/feedbox}-->
</div>
</div>
</div></div></div></div>
<!--{/if}-->
在下边添加:
<br />
<table width="540" height="33" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="77" height="33"><img src="image/ct.gif" width="77" height="33" /></td>
<td width="363" background="image/ct2.gif" align="left"><!--{if $isnovel||$do != 'index'}-->
<!--{eval get_laba();$i=0;}-->
<div style="position: relative;padding:5px 0;width:363px; margin:0 auto;">
<ul style="position:absolute;height:30px;line-height:30px;text-align:left;overflow:hidden;top:-12px;" id="top_scroll">
<!--{loop $_SGLOBAL['laba'] $value}-->
<!--{eval $say = addslashes(preg_replace('/\r|\n/is', '', shtmlspecialchars($value[say])));}-->
<li><a id="laba_user" style="color:#1782db" href="space.php?uid={$value[uid]}"></a>(<span id="laba_time" class="gray"><!--{date('Y-m-d H:i',$value[dateline],1)}--></span>)<span id="laba_act">{$value[act]}</span>:<span id="laba_content">$say</span></li>
<!--{eval break;}-->
<!--{/loop}-->
</ul>
</div>
<script>
var labas = Array();
<!--{loop $_SGLOBAL['laba'] $value}-->
<!--{eval $say = addslashes(preg_replace('/\r|\n/is', '', shtmlspecialchars($value[say])));}-->
labas[{$i}]= ['{$value[uid]}','<!--{eval echo addslashes($value[username])}-->','<!--{date('Y-m-d H:i',$value[dateline],1)}-->','{$value[act]}','{$say}', '<!--{eval echo get_rndcolor();}-->','<!--{eval echo get_rndcolor();}-->',{$value[dealy]}];
<!--{eval $i++;}-->
<!--{/loop}-->
var topindex =0;
function topdealy(){
if(labas.length<topindex+1)topindex=0;
$('laba_user').innerHTML = labas[topindex][1];
$('laba_user').href = 'space.php?uid='+labas[topindex][0];
$('laba_time').innerHTML = labas[topindex][2];
$('laba_act').innerHTML = labas[topindex][3];
$('laba_content').innerHTML = labas[topindex][4];
$('laba_content').style.color = labas[topindex][5];
$('laba_act').style.color = labas[topindex][6];
setTimeout('topdealy()', labas[topindex][7]*1000);
topindex++;
}
topdealy();
</script>
<!--{/if}--></td>
<td width="100"><a href="laba.php"><img src="image/ct3.gif" width="100" height="33" border="0" /></a></td>
</tr>
</table>
去后台更新缓冲,添加一个任务,定期清除喇叭。
即可...
第一步导入数据库从哪里导入 还有最后添加一个任务在哪里添加? |