Kanont, har ikke lige set om det virker men kigger på det imorgen.. Prøver lige at sætte den kode ind jeg har i mine 2 filer phpfilen og templatefilen som behandler data fra den.. Håber ikke det kommer til se alt for uoverskueligt ud.
(simple_block.php)
<?php
function b_onair_show() {
include_once XOOPS_ROOT_PATH.'/modules/onair/include/functions.php';
global $xoopsDB,$xoopsModuleConfig, $XoopsConfig;
$nowday=date('w');
$nextstop="00:00:00";
$oa_imagedir = oa_getmoduleoption('imagedir');
$oa_shothigh = oa_getmoduleoption('shotheight');
$oa_shotwide = oa_getmoduleoption('shotwidth');
$timetype = oa_getmoduleoption('timetype');
if ($timetype=='1')
{ $nowtime =date('h:i:s a'); }
else if ($timetype=='0'){$nowtime =date('H:i:s');}
$block = array();
$myts =& MyTextSanitizer::getInstance();
$sql = "SELECT * FROM ".$xoopsDB->prefix("oa_program")." WHERE ('$nowtime' BETWEEN oa_start AND oa_stop) AND '$nowday' = oa_day ORDER BY oa_day,oa_start LIMIT 1";
$result=$xoopsDB->queryF($sql);
while($myrow=$xoopsDB->fetchArray($result))
{
$message = array();
$oa_pluginname = $myrow['oa_plugin'];
include XOOPS_ROOT_PATH.'/modules/onair/plugins/plugins.php';
$message['id'] = $myrow['oa_id'];
$message['day'] = numbers2daysblock($myrow['oa_day']);
if ($timetype=='1'){
$message['start'] = date('h:i:s a', strtotime($myrow['oa_start']));
$message['stop'] = date('h:i:s a', strtotime($myrow['oa_stop']));
$nextstop = date('h:i:s a', strtotime($myrow['oa_stop']));
} else if ($timetype=='0'){
$message['start'] = date('H:i:s', strtotime($myrow['oa_start']));
$message['stop'] = date('H:i:s', strtotime($myrow['oa_stop']));
$nextstop = date('H:i:s', strtotime($myrow['oa_stop']));
}
$title = $myts->stripSlashesGPC($myrow["oa_title"]);
$message['title'] = $title;
$station = $myts->stripSlashesGPC($myrow["oa_station"]);
$message['station'] = $station;
$name = $myts->stripSlashesGPC($myrow["oa_name"]);
$message['name'] = $name;
$description = $myts->stripSlashesGPC($myrow["oa_description"]);
$message['description'] = $description;
$image = $myrow["oa_image"];
$message['image'] = "<img src='".XOOPS_URL."/".$oa_imagedir.$image."' height='".$oa_shothigh."' width='".$oa_shotwide."' alt='"._VISITWEBSITE."' /></img>";
$message['host'] = _MB_ONAIR_HOST;
$block['onair'][] = $message;
}
$sqlnext = "SELECT * FROM ".$xoopsDB->prefix("oa_program")." WHERE '$nextstop' <= oa_start AND '$nowday' = oa_day order by oa_day, oa_start, oa_stop LIMIT 1";
$resultnext=$xoopsDB->queryF($sqlnext);
if ( $resultnext ){
while($myrownext=$xoopsDB->fetchArray($resultnext))
{
$messagenext = array();
$messagenext['id'] = $myrownext['oa_id'];
$messagenext['day'] = numbers2daysblock($myrownext['oa_day']);
if ($timetype=='1'){
$messagenext['start'] = date('h:i:s a', strtotime($myrownext['oa_start']));
$messagenext['stop'] = date('h:i:s a', strtotime($myrownext['oa_stop']));
} else {
$messagenext['start'] = date('H:i:s', strtotime($myrownext['oa_start']));
$messagenext['stop'] = date('H:i:s', strtotime($myrownext['oa_stop']));
}
$titlenext = $myts->stripSlashesGPC($myrownext["oa_title"]);
$messagenext['title'] = $titlenext;
$stationnext = $myts->stripSlashesGPC($myrownext["oa_station"]);
$messagenext['station'] = $stationnext;
$namenext = $myts->stripSlashesGPC($myrownext["oa_name"]);
$messagenext['name'] = $namenext;
$descriptionnext = $myts->stripSlashesGPC($myrownext["oa_description"]);
$messagenext['description'] = $descriptionnext;
$imagenext = $myts->stripSlashesGPC($myrownext["oa_image"]);
$messagenext['image'] = "<img src='".XOOPS_URL."/".$oa_imagedir.$imagenext."' height='".$oa_shothigh."' width='".$oa_shotwide."' alt='"._VISITWEBSITE."' /></img>";
$messagenext['comup'] = _MB_ONAIR_COMINGUP;
$block['onair2'][] = $messagenext;
}
}else{
echo mysql_error();
return false;
}
return $block;
}
?>
(Onair_block.html)
<html>
<head>
<style type="text/css">
#dropcontentsubject{
width: 90%;
font-weight: bold;
}
.dropcontent{
display:block;
}
</style>
<script type="text/javascript">
/***********************************************
* ProHTML Ticker script- © Dynamic Drive (
www.dynamicdrive.com)
* This notice must stay intact for use
* Visit
http://www.dynamicdrive.com/ for full source code
***********************************************/
var tickspeed=10000 //ticker speed in miliseconds (2000=2 seconds)
var enablesubject=1 //enable scroller subject? Set to 0 to hide
if (document.getElementById){
document.write('<style type="text/css">\n')
document.write('.dropcontent{display:none;}\n')
document.write('</style>\n')
}
var selectedDiv=0
var totalDivs=0
function contractall(){
var inc=0
while (document.getElementById("dropmsg"+inc)){
document.getElementById("dropmsg"+inc).style.display="none"
inc++
}
}
function expandone(){
var selectedDivObj=document.getElementById("dropmsg"+selectedDiv)
contractall()
document.getElementById("dropcontentsubject").innerHTML=selectedDivObj.getAttribute("subject")
selectedDivObj.style.display="block"
selectedDiv=(selectedDiv<totalDivs-1)? selectedDiv+1 : 0
setTimeout("expandone()",tickspeed)
}
function startscroller(){
while (document.getElementById("dropmsg"+totalDivs)!=null)
totalDivs++
expandone()
if (!enablesubject)
document.getElementById("dropcontentsubject").style.display="none"
}
if (window.addEventListener)
window.addEventListener("load", startscroller, false)
else if (window.attachEvent)
window.attachEvent("onload", startscroller)
</script>
<script type="text/javascript" src="<{$xoops_url}>/modules/onair/include/projax/js/prototype.js"></script>
<script type="text/javascript" src="<{$xoops_url}>/modules/onair/include/projax/js/scriptaculous.js"></script>
</head>
<body>
<div id="dropcontentsubject"></div>
<{foreach item=message from=$block.onair}>
<div id="dropmsg0" class="dropcontent">
<center><b><{$message.station}></b></center><br/>
<center><code><b><{$message.title}></b></code></center><br/>
<center><a href="<{$xoops_url}>/modules/onair/detail.php?ext=info&oa_id=<{$message.id}>"><{$message.image}></a></center>
<center><h4><{$message.host}><{$message.name}></h4></center><br/>
<center><img src="<{$xoops_url}>/modules/onair/images/icons/musicnote.png"> <{$message.pluginshow}></center><br/>
<center><{$message.day}></center>
<center><h4><{$message.start}> - <{$message.stop}></h4></center>
</div>
<{foreach item=messagenext from=$block.onair2}>
<div id="dropmsg1" class="dropcontent">
<center><{$messagenext.comup}></center><br/>
<center><{$messagenext.station}></center>
<center><code><b><{$messagenext.title}></b></code></center>
<center><a href="<{$xoops_url}>/modules/onair/detail.php?ext=info&oa_id=<{$messagenext.id}>"><{$messagenext.image}></a></center><br/>
<center><h4><{$message.host}><{$messagenext.name}></h4></center><br>
<center><{$messagenext.day}></center>
<center><h4><{$messagenext.start}> - <{$messagenext.stop}></h4></center>
</div><{/foreach}>
<{/foreach}>
</body>
</html>