Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-02-2005, 05:55 AM
sross sross is offline
 
Join Date: Mar 2004
Posts: 355
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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>
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:19 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03564 seconds
  • Memory Usage 2,180KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete