vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   RSS2/External Data Provider on non-vB page (https://vborg.vbsupport.ru/showthread.php?t=170748)

Eq4bits 02-17-2008 02:11 PM

RSS2/External Data Provider on non-vB page
 
1 Attachment(s)
RSS2 Display on External Page
Running vB3.6.8PL2
Using the 'How To' from This Thread
page coded as follows:
Code:

<?php include "header.php";
// ######################################################
// ## configuration
 // ##
 // ## $rss2_file= 'http://www.****.net/forums/external.php?type=rss2&forumids=39&lastpost=1';
 // ## Adjust this variable to point to your RSS2 feed
 
 $rss2_file = 'http://www.****.net/forums/external.php?type=rss2&forumids=39&lastpost=1';
   
 // ## configuration end
 // ######################################################
 // ## Do not touch code below!
   
   
 $is_item = false;
 $tag = '';
 $title = '';
 $description = '';
 $link = '';
 $date = '';
 $author = '';
   
 function character_data($parser, $data)
 {
    global $is_item, $tag, $title, $description, $link, $date, $author;
    if ($is_item)
    {
        switch ($tag)
        {
            case "TITLE":
            $title .= $data;
            break;
   
            case "DESCRIPTION":
            $description .= $data;
            break;
   
            case "LINK":
            $link .= $data;
            break;
   
            case "PUBDATE":
            $date .= $data;
            break;
   
            case "AUTHOR":
            $author .= $data;
            break;
        }
    }
 }
   
 function begin_element($parser, $name)
 {
    global $is_item, $tag;
    if ($is_item)
    {
        $tag = $name;
    }
    else if ($name == "ITEM")
    {
        $is_item = true;
    }
 }
   
 function end_element($parser, $name)
 {
    global $is_item, $title, $description, $link, $date, $author, $rss2_output;
    if ($name == "ITEM")
    {
        $rss2_output .= "<dt><strong><a href='" . trim($link) . "'>" . htmlspecialchars(trim($title)) . "</a></strong> - " . htmlspecialchars(trim($date)) . " by <em>" . htmlspecialchars(trim($author)) . "</em></dt><dd>" . htmlspecialchars(trim($description)) . "</dd>";
        $title = "";
        $description = "";
        $link = "";
        $date = "";
        $author = "";
        $is_item = false;
    }
 }
   
   
 $parser = xml_parser_create();
   
 xml_set_element_handler($parser, "begin_element", "end_element");
 xml_set_character_data_handler($parser, "character_data");
 $fp = fopen($rss2_file,"r");
   
 while ($data = fread($fp, 4096))
 {
    xml_parse($parser, $data, feof($fp));       
 }
   
 fclose($fp);
 xml_parser_free($parser); ?>
<table
style="width: 100%; text-align: left; margin-left: auto; margin-right: auto;"
border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;"><span
style="text-decoration: underline; font-style: italic; font-weight: bold;">WELCOME
MESSAGE</span><br>
blah blah blah yada yada yada blah blah blah yada yada yada blah blah
blah yada yada yada blah blah blah yada yada yada blah blah blah yada
yada yada blah blah blah yada yada yada
blah blah blah yada yada yada blah blah blah yada yada yada blah blah
blah yada yada yada<br>
</td>
</tr>
</tbody>
</table>
<span style="font-family: calisto mt;"></span>
<table style="text-align: left; width: 577px; height: 315px;"
border="0" cellpadding="15" cellspacing="5">
<tbody>
<tr>
<td style="width: 60%; vertical-align: top;"><span
style="font-style: italic; text-decoration: underline; font-weight: bold;">NEWS<br>
</span>
<p style="text-align: justify;"><left></left><big
style="font-family: garamond;"><font color="#302808"><small><?php include "echo $rss2_output"; ?>
<br>
<p style="text-align: left;"><font color="#302808"><big>Click
<b><a
href="http://www.****.net/forums/showthread.php?t=2605">HERE</a></b>
for more Current Events!</big></font></p>
</td>
<td style="width: 40%; vertical-align: top;"> <span
style="text-decoration: underline; font-style: italic; font-weight: bold;">HOT
LINKS</span><br>
<span
style="text-decoration: underline; font-style: italic; font-weight: bold;"></span><br>
<big><span style="font-family: garamond;"><a href="http://www.****.net/holds/Maps/index.php">Territory
Maps</a></span><br style="font-family: garamond;">
<span style="font-family: garamond;"><a href="http://www.****.net/weyr/Maps/index.php">Weyr Maps</a></span><br
style="font-family: garamond;">
<span style="font-family: garamond;">Resident Lists(link)</span><br
style="font-family: garamond;">
<span style="font-family: garamond;"><a href="http://www.****.net/home/Guides/index.php">Persona Guide</a></span><br
style="font-family: garamond;">
<span style="font-family: garamond;"><a href="http://www.****.net/club/Canon/index.php">Canon</a></span><br style="font-family: garamond;">
<span style="font-family: garamond;"><a href="http://www.****.net/club/Participation/index.php">Membership & Participation
Policies</a></span><br style="font-family: garamond;">
<span style="font-family: garamond;"><a href="http://www.****.net/club/Pern101/index.php">Pern 101</a></span><br style="font-family: garamond;">
<span style="font-family: garamond;">Create/Submit a
Persona(whizzy link)</span></big> </td>
</tr>
</tbody>
</table>
<span style="font-family: calisto mt;"></span>
<div style="text-align: left;"><font face="Calisto MT"> </font></div>
<div style="text-align: left;"> </div>
<table
style="width: 100%; text-align: left; margin-left: auto; margin-right: auto;"
border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;">
<div> </div>
<div style="text-align: center;"><span
style="font-weight: bold;"></span> <br>
<br>
</div>
</td>
</tr>
</tbody>
</table>
<table style="width: 100%; margin-left: auto; margin-right: auto;"
border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="vertical-align: top;"> <span
style="color: rgb(153, 51, 0);">
<center><br>
<a title="Take The Tour!"
onmouseover="changeImages( /*CMP*/'tour_up',/*URL*/'images/tour_over.jpg');return true"
onmouseout="changeImages( /*CMP*/'tour_up',/*URL*/'images/tour_up.jpg');return true"
href="http://www.****.net/home/Tour/tour1.html"><img
src="images/tour_up.jpg" alt="" name="tour_up" border="0" height="40"
width="113"></a><br>
<br>
</center>
</span></td>
</tr>
</tbody>
</table>
<font face="Calisto MT"> </font></td>
</tr>
</tbody>
</table>

<?php include "footer.php" ?>

But am getting the following displayed on the page where I put the "echo $rss2_output" for the threads & descripts(etc) to show up:
Quote:

Warning: main(echo <dt><strong><a href='http://www.*****.***/forums/showthread.php?t=7604&goto=newpost'>Attention! - BoD Nominations - Spring 2008!</a></strong> - Fri, 15 Feb 2008 14:06:21 GMT by <em></em></dt><dd>*Attention all Would-Be BOD members!* The time has come to start composing your nomination for the Spring 2008 elections. * The BOD is open to all...</dd><dt><strong><a href='http://www.*****.***/forums/showthread.php?t=7505&goto=newpost'>Lindsay and the Wild Web</a></strong> - Thu, 14 Feb 2008 04:54:07 GMT by <em></em></dt><dd>Since things have gotten reorganized/moved around be sure to check out the new site map (use the link from the dropdown 'FAQ' button in the navbar)...</dd><dt><strong><a href='http://www.*****.***/forums/showthread.php?t=7563&goto=newpost'>Attention! - It's ALL About Perception!</a></strong> - M in /home/*****/public_html/index-tour.php on line 120

Warning: main(echo <dt><strong><a href='http://www.*****.***/forums/showthread.php?t=7604&goto=newpost'>Attention! - BoD Nominations - Spring 2008!</a></strong> - Fri, 15 Feb 2008 14:06:21 GMT by <em></em></dt><dd>*Attention all Would-Be BOD members!* The time has come to start composing your nomination for the Spring 2008 elections. * The BOD is open to all...</dd><dt><strong><a href='http://www.*****.***/forums/showthread.php?t=7505&goto=newpost'>Lindsay and the Wild Web</a></strong> - Thu, 14 Feb 2008 04:54:07 GMT by <em></em></dt><dd>Since things have gotten reorganized/moved around be sure to check out the new site map (use the link from the dropdown 'FAQ' button in the navbar)...</dd><dt><strong><a href='http://www.*****.***/forums/showthread.php?t=7563&goto=newpost'>Attention! - It's ALL About Perception!</a></strong> - M in /home/*****/public_html/index-tour.php on line 120

Warning: main(echo <dt><strong><a href='http://www.*****.***/forums/showthread.php?t=7604&goto=newpost'>Attention! - BoD Nominations - Spring 2008!</a></strong> - Fri, 15 Feb 2008 14:06:21 GMT by <em></em></dt><dd>*Attention all Would-Be BOD members!* The time has come to start composing your nomination for the Spring 2008 elections. * The BOD is open to all...</dd><dt><strong><a href='http://www.*****.***/forums/showthread.php?t=7505&goto=newpost'>Lindsay and the Wild Web</a></strong> - Thu, 14 Feb 2008 04:54:07 GMT by <em></em></dt><dd>Since things have gotten reorganized/moved around be sure to check out the new site map (use the link from the dropdown 'FAQ' button in the navbar)...</dd><dt><strong><a href='http://www.*****.***/forums/showthread.php?t=7563&goto=newpost'>Attention! - It's ALL About Perception!</a></strong> - M in /home/*****/public_html/index-tour.php on line 120

Warning: main() [function.include]: Failed opening 'echo <dt><strong><a href='http://www.*****.***/forums/showthread.php?t=7604&goto=newpost'>Attention! - BoD Nominations - Spring 2008!</a></strong> - Fri, 15 Feb 2008 14:06:21 GMT by <em></em></dt><dd>*Attention all Would-Be BOD members!* The time has come to start composing your nomination for the Spring 2008 elections. * The BOD is open to all...</dd><dt><strong><a href='http://www.*****.***/forums/showthread.php?t=7505&goto=newpost'>Lindsay and the Wild Web</a></strong> - Thu, 14 Feb 2008 04:54:07 GMT by <em></em></dt><dd>Since things have gotten reorganized/moved around be sure to check out the new site map (use the link from the dropdown 'FAQ' button in the navbar)...</dd><dt><strong><a href='http://www.*****.***/forums/showthread.php?t=7563&goto=newpost'> in /home/*****/public_html/index-tour.php on line 120
And yes I have the External Data settings turned on in vBOptions
screenshot (attached) & 'line 120' is the '?php include "echo $rss2_output"; ?' line

Any assistance to get this to work/display 'right' would be appreciated.

Eq4bits 02-17-2008 03:42 PM

n/m, figured it out :D

Eq4bits 02-17-2008 05:21 PM

1 Attachment(s)
Like I said in the above post I got the code fixed to display with the rss2 feed on my non-vB page (outside of the forums directory). My next question is why the 'author' isn't showing up (see attachment). I actually don't care to have the 'author' showing, but the "....by " is a bit disconcerting. Is their a way to remove the 'by' from displaying altogether? Is there a way to keep the post date from displaying, since I might not want that either?


All times are GMT. The time now is 04:00 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01119 seconds
  • Memory Usage 1,777KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete