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

Reply
 
Thread Tools Display Modes
  #1  
Old 02-17-2008, 02:11 PM
Eq4bits Eq4bits is offline
 
Join Date: May 2006
Posts: 468
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default RSS2/External Data Provider on non-vB page

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.
Attached Images
File Type: png echo-prob.png (88.7 KB, 0 views)
Reply With Quote
  #2  
Old 02-17-2008, 03:42 PM
Eq4bits Eq4bits is offline
 
Join Date: May 2006
Posts: 468
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

n/m, figured it out
Reply With Quote
  #3  
Old 02-17-2008, 05:21 PM
Eq4bits Eq4bits is offline
 
Join Date: May 2006
Posts: 468
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Attached Images
File Type: png rss2-display-nonVBpage.png (4.5 KB, 0 views)
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 11:23 AM.


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.03390 seconds
  • Memory Usage 2,226KB
  • Queries Executed 12 (?)
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_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (3)postbit
  • (2)postbit_attachment
  • (3)postbit_onlinestatus
  • (3)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_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_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete