07-02-2005, 05:55 AM
|
|
|
Join Date: Mar 2004
Posts: 355
Благодарил(а): 0 раз(а)
Поблагодарили:
0 раз(а) в 0 сообщениях
|
|
need help with loading phpbased rss feed into template
Hi, If this code is placed in a standalone file it loads fine, but i want it to live in a table on a vb3 template. I tried tinkering with php include with no luck since I am not a coder. I am pasting the code below, does anyone know how to get this to load in a vb3 template? Is this going to be a nightmare to do? Thanks!!
Quote:
<?php require_once('Connections/rss.php'); ?>
<?php
//RSS functions include
require_once('includes/MXRSS/MX_Rss.inc.php');
$currentPage = $_SERVER["PHP_SELF"];
$MXRSS_rsRSS = new MX_RssReader();
$MXRSS_rsRSS->setConnection($database_rss, $rss);
$MXRSS_rsRSS->setCacheTime(60);
$MXRSS_rsRSS->getFeed("http://rss.news.yahoo.com/rss/tech");
// Start RSS Recordset
$maxRows_rsRSS = 5;
$pageNum_rsRSS = 0;
if (isset($HTTP_GET_VARS['pageNum_rsRSS'])) {
$pageNum_rsRSS = $HTTP_GET_VARS['pageNum_rsRSS'];
}
$startRow_rsRSS = $pageNum_rsRSS * $maxRows_rsRSS;
$rsRSS = $MXRSS_rsRSS->getRssRecordset($startRow_rsRSS, $maxRows_rsRSS);
$row_rsRSS = mysql_fetch_assoc($rsRSS);
$totalRows_rsRSS = $MXRSS_rsRSS->recordCount();
$totalPages_rsRSS = ceil($totalRows_rsRSS/$maxRows_rsRSS)-1;
// End RSS Recordset
$queryString_rsRSS = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_rsRSS") == false &&
stristr($param, "totalRows_rsRSS") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_rsRSS = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_rsRSS = sprintf("&totalRows_rsRSS=%d%s", $totalRows_rsRSS, $queryString_rsRSS);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {font-size: small}
-->
</style>
</head>
<body>
<link rel="stylesheet" href="includes/MXRSS/styles/MX_RSS.css" type="text/css"/>
<?php if ($totalRows_rsRSS == 0) { // Show if recordset empty ?>
<?php echo $MXRSS_rsRSS->getError(); ?>
<?php } // Show if recordset empty ?>
<?php if ($totalRows_rsRSS > 0) { // Show if recordset not empty ?>
<table border="0" cellpadding="0" cellspacing="0" width="50%" class="tableStyle">
<tr>
<th class="tableHead"> <a href="<?php echo $row_rsRSS['channel_link']; ?>" target="_blank"> <span class="channelTitle style1"><?php echo $row_rsRSS['channel_title']; ?></span></a></th>
</tr>
<?php $MXRSS_rsRSS_counter = $startRow_rsRSS+1;?>
<?php do { ?>
<tr>
<td class="tableRow"><?php echo $MXRSS_rsRSS_counter++; ?>. <a href="<?php echo $row_rsRSS['item_link']; ?>" target="_blank"><span class="itemTitle style1"><?php echo $row_rsRSS['item_title']; ?></span></a></td>
</tr>
<?php } while ($row_rsRSS = mysql_fetch_assoc($rsRSS)); ?>
<tr>
<td height="20" class="tableRow style1"> Records <?php echo ($startRow_rsRSS + 1) ?> to <?php echo min($startRow_rsRSS + $maxRows_rsRSS, $totalRows_rsRSS) ?> of <?php echo $totalRows_rsRSS ?> </td>
</tr>
<tr>
<td class="tableRow"><table border="0" align="left">
<tr>
<td align="center"><?php if ($pageNum_rsRSS > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_rsRSS=%d%s", $currentPage, 0, $queryString_rsRSS); ?>">First</a>
<?php } // Show if not first page ?>
<?php if ($pageNum_rsRSS == 0) { // Show if first page ?>
First
<?php } // Show if first page ?>
</td>
<td align="center"><?php if ($pageNum_rsRSS > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_rsRSS=%d%s", $currentPage, max(0, $pageNum_rsRSS - 1), $queryString_rsRSS); ?>">Prev</a>
<?php } // Show if not first page ?>
<?php if ($pageNum_rsRSS == 0) { // Show if first page ?>
Prev
<?php } // Show if first page ?>
</td>
<td align="center"><?php if ($pageNum_rsRSS < $totalPages_rsRSS) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_rsRSS=%d%s", $currentPage, min($totalPages_rsRSS, $pageNum_rsRSS + 1), $queryString_rsRSS); ?>">Next</a>
<?php } // Show if not last page ?>
<?php if ($pageNum_rsRSS >= $totalPages_rsRSS) { // Show if last page ?>
Next
<?php } // Show if last page ?>
</td>
<td align="center"><?php if ($pageNum_rsRSS < $totalPages_rsRSS) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_rsRSS=%d%s", $currentPage, $totalPages_rsRSS, $queryString_rsRSS); ?>">Last</a>
<?php } // Show if not last page ?>
<?php if ($pageNum_rsRSS >= $totalPages_rsRSS) { // Show if last page ?>
Last
<?php } // Show if last page ?>
</td>
</tr>
</table></td>
</tr>
</table>
<?php } // Show if recordset not empty ?>
</body>
</html>
|
|