<table>
<tr>
<?
//THIS IS TO PARSE THE *******.COM RSS FEED: http://*******.com/videos/rss.php?show=latest
//$pid = "pid=xxxxxx";
//THIS IS THE NUMBER PER ROW
$maxPerRow = 4;
//THIS IS THE NUMBER OF ROWS
$maxRows = 3;
///////////////////////////////////////////////////////////////////////////////
function getElement($elementName, $text)
{
$beg = strpos($text, "<$elementName>") + strlen($elementName) + 2;
$end = strpos($text,"</$elementName>");
return substr($text, $beg, $end - $beg);
}
function getElementByPosition($elementName, $text, $elementPosition)
{
$index = strpos($text, "<$elementName>");
for($x = 0; $x < $elementPosition; $x++)
{
$beg = strpos($text, "<$elementName>", $index) + strlen($elementName) + 2;
$end = strpos($text,"</$elementName>", $index);
$index = $end + 1;
}
return substr($text, $beg, $end - $beg);
}
function getEnclosureURL($text)
{
$beg = strpos($text, "<enclosure url=\"") + strlen($elementName) + 16;
$end = strpos($text,"\"", $beg);
return substr($text, $beg, $end - $beg);
}
//this function doesn't exist as part of standard until PHP4, so its defined here in case version < 4
if(!function_exists( 'html_entity_decode'))
{
function html_entity_decode( $given_html, $quote_style = ENT_QUOTES )
{
$trans_table = array_flip(get_html_translation_table( HTML_SPECIALCHARS, $quote_style ));
$trans_table['''] = "'";
return ( strtr( $given_html, $trans_table ) );
}
}
//variables
$title = '';
$description = '';
$link = '';
$lastUpdate = '';
$item_title = '';
$item_link = '';
$item_description = '';
$item_image = '';
$item_category1 = '';
$item_category2 = '';
$item_category3 = '';
$item_category4 = '';
$item_category5 = '';
$item_category6 = '';
$item_category7 = '';
$item_category8 = '';
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// *IMPORTANT!!
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// CHANGE THE PID TO MATCH YOUR PID IN THE rss_parser URL BELOW
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
$rss_parser = "http://*******.com/videos/rss.php?show=latest";
if(!allow_url_fopen)
{
print("You must enable PHP to read remote files via URL. This can be set in the php.ini.");
}
else
{
$feed = fopen($rss_parser,"r")
or die(" ");
$counter = 0;
$maxSize = ($maxPerRow * $maxRows) * 10000;
$content = '';
while(!feof($feed))
{
$content .= fread($feed, 8192);
if((++$counter * 8192) > $maxSize)
break;
}
fclose($feed);
$content = trim($content);
$title = getElement("title", $content);
$description = getElement("description", $content);
$link = getElement("link", $content);
$lastUpdate = getElement("lastBuildDate", $content);
$content = substr($content, strpos($content,"<item>"));
$content = substr($content, 0, ($content.LENGTH - 20));
$items = explode("<item>", $content);
$itemCount = count($items);
//echo "item count: $itemCount<br>";
$lineCount = 0;
$rowCount = 0;
for($x = 1; $x < $itemCount; $x++)
{
if($rowCount == $maxPerRow)
{
print("</tr>");
if(++$lineCount >= $maxRows)
break;
print("<tr>");
$rowCount = 0;
}
$rowCount++;
$item = $items[$x];
$item_title = getElement("title", $item);
$item_link = getElement("link", $item);
$item_link = str_replace("bio", "view", $item_link);
//print($item_link);
//$item_link .= "&$pid";
//$item_description = getElement("description", $item);
$item_image = getEnclosureURL($item);
//$item_category1 = getElementByPosition("category", $item, 1);
//$item_category2 = getElementByPosition("category", $item, 2);
?>
<td>
<table width="150" border="1" cellpadding="2">
<tr>
<td align="center">
<font size=2><a href="<? print("$item_link"); ?> " target="_blank"><? print("$item_title"); ?></a></font>
</td>
</tr>
<tr>
<td align="center">
<a href="<? print("$item_link"); ?>" target="_blank">
<img src="<? print("$item_image"); ?>" border="0"/></a>
</td>
</tr>
</table>
</td>
<?
}
}
?>
</tr>
</table>