Gordon’s Radio Archives
$pod = '/';
$podfile = 'gordon_wilson.rss';
$rss = simplexml_load_file($podfile);
if($rss===false) echo 'RSS Not Loaded';
$showname = utf8_decode($rss->channel->title);
$thehead = '
';
$thetail = '
';
$lastdate = '';
$tmpshow = '';
$lastshonum = '';
$divnum = 0;
foreach ($rss->channel->item as $item) {
if($item->arfmtbk == 'yes') {break;}
$airdt = utf8_decode($item->showdate);
$shonum = intval($item->achievesn);
if($shonum == '') $shonum = 0;
if(trim(substr($airdt,0,2)) == '20') {
$btntime = substr($airdt,12,2);
if($btntime > 12) {$btntime -= 12; $btnampm = 'pm';} else {$btnampm = 'am';}
if($btntime == 12) $btnampm = 'pm';
if($btntime == 0) {$btntime = 12; $btnampm = 'am';}
//if($btntime < 10) $btntime = '0' . $btntime;
$airdt = substr($airdt, 0, 10);
$btnprint = 'at ' . $btntime . ':00' . $btnampm;
} else {
$btntime = substr($airdt,-8,8);
$btnprint = $btntime;
$airdt = substr($airdt,0,13);
}
if(($airdt != $lastdate) | ($shonum != $lastshonum)) {
if($tmpshow != '') { //print last run
++$divnum;
echo $thehead;
echo $tmpshow;
//echo '
';
echo $tmpbtn;
echo $thetail;
$tmpshow = '';
$tmpbtn = '';
}
$lastdate = $airdt;
$lastshonum = $shonum;
if($item->image <> "")
$imagex = str_ireplace( 'http://achieveradio.com','/home/achie3/public_html',$item->image);
if($imagex != '')$imgsize=getimagesize($imagex);
if($item->imgw > 0){ $width = "width=\"$item->imgw\"";} else {$width = '';}
if($item->imgh > 0){ $height = "height=\"$item->imgh\"";} else {$height = '';}
if(($imgsize[0]>180)||($item->imgw>180)) {
$width = 'width="180"';
if($imgsize[0]>$item->imgw){$twidth=$imgsize[0];}else{$twidth=$item->imgw;}
$theight = (180/$twidth)*$imgsize[1];
$tmht=round($theight);
$height='height="'.$tmht.'"';
}
if($item->subfmt == '' | $item->subfmt == 'auto'){
if(strlen($item->subhead) > 60) {$item->subfmt = 'justify';} else {$item->subfmt = 'center';}
}
if($item->descfmt == '' | $item->descfmt == 'auto'){
if(strlen($item->description) > 80) {$item->descfmt = 'justify';} else {$item->descfmt = 'center';}
}
$ptlink = false;
$complink = utf8_decode($item->complink);
if($complink <>''){
$ptlink = true;
if(stripos($complink,'http://') === false){$complink = 'http://' . $complink;}}
$ptlink2 = false;
$complink2 = utf8_decode($item->complink2);
if($complink2 <>''){
$ptlink2 = true;
if(stripos($complink2,'http://') === false){$complink2 = 'http://' . $complink2;}}
$ptlink3 = false;
$complink3 = utf8_decode($item->complink3);
if($complink3 <>''){
$ptlink3 = true;
if(stripos($complink3,'http://') === false){$complink3 = 'http://' . $complink3;}}
$tmptitle = htmlspecialchars_decode(nl2br($item->title));
$tmpshow = "
" . "
" . '
' . 'From ' . $airdt . '
' . $tmptitle . '
'; //title
if($item->subhead <> "") {$tmpshow .= '
' . htmlspecialchars_decode(nl2br($item->subhead)) . '
'; }
if($item->description <> ''){ $tmpshow .= '
';
if($item->image <> ""){$tmpshow .= "image\"> image . "\" $width $height align=\"left\" style=\"margin-right:10px;\">";}
$tmpshow .= htmlspecialchars_decode(nl2br($item->description)) . '
';}
if($ptlink | $ptlink2 | $ptlink3) {$tmpshow .= '
';}
if($ptlink){
$templink = $item->complink;
if(strlen($templink) > 50) {
$xxcomplink = substr($templink, 0, 50) . '...';} else {$xxcomplink = $templink;}
$tmpshow .= '' . $xxcomplink . ''; }
if($ptlink2){
$templink2 = $item->complink2;
if(strlen($templink2) > 50) {
$xxcomplink2 = substr($templink2, 0, 50) . '...';} else {$xxcomplink2 = $templink2;}
$tmpshow .= '
' . $xxcomplink2 . ''; }
if($ptlink3){
$templink3 = $item->complink3;
if(strlen($templink3) > 50) {
$xxcomplink3 = substr($templink3, 0, 50) . '...';} else {$xxcomplink3 = $templink3;}
$tmpshow .= '
' . $xxcomplink3 . ''; }
if($ptlink | $ptlink2 | $ptlink3) {$tmpshow .= '
';}
$tmpbtn = '
' . $btnprint . '
';
}
else {
$tmpbtn = '
' . $btnprint . '
' . $tmpbtn;
}
}
if($tmpshow != '') { //print last run
echo $thehead;
echo $tmpshow;
echo $tmpbtn;
echo '
';
echo $thetail;
$lastdate = $airdt;
$lastshonum = $shonum;
$tmpshow = '';
$tmpbtn = '';
}
?>