RSS Feeds

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TheMusicMan
    Senior Member
    • Oct 2002
    • 2140
    • 3.7.x

    RSS Feeds

    I would like to be able to have users show the last 'n' posts from my www site on their own www sites. How would I go about enabling this and how can I test to see if this works by installing on another of my own sites...?

    What would I need to do on my test site to have this show... how do I do it?

    Cheers
    Last edited by TheMusicMan; Sat 20 Nov '04, 2:49pm.
    John
  • Steve Machol
    Former Customer Support Manager
    • Jul 2000
    • 154488

    #2
    Here's a thread explaining the built-in external feed system:



    And here's the online documentation:

    Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
    Change CKEditor Colors to Match Style (for 4.1.4 and above)

    Steve Machol Photography


    Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


    Comment

    • TheMusicMan
      Senior Member
      • Oct 2002
      • 2140
      • 3.7.x

      #3
      Thanks Steve, very useful indeed.

      What is it I need to do to get these to display on another www site? How do I display the output from external.php on another site?
      John

      Comment

      • Steve Machol
        Former Customer Support Manager
        • Jul 2000
        • 154488

        #4
        They would just use the links in Wayne's post:



        Of course, they will need to format this output into their own page.
        Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
        Change CKEditor Colors to Match Style (for 4.1.4 and above)

        Steve Machol Photography


        Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


        Comment

        • TheMusicMan
          Senior Member
          • Oct 2002
          • 2140
          • 3.7.x

          #5
          I tried that Steve to no avail.

          I enabled the External Java on my site and when I call the external.php?type=js, I get sonething returned but it looks like code. How do I get this code to display?? If I want to allow my members to have say the latest 'n' topics from my site displayed on their site, what code do they have to put into one of their browser pages...? Is it a direct link somewhere in one of their html pages to my sites external.php?type=js pahe, or is it the output of what that php page actually generates/delivers...?

          Sorry if I don't quite grasp it yet, I'm sure I will soon with some more help. Cheers.
          John

          Comment

          • daemon
            Senior Member
            • Jun 2003
            • 2351
            • 3.5.x

            #6
            Here's a sample way to use JS feeds:

            HTML Code:
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml">
            <head>
            	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
            	<title>External JS Printing</title>
            </head>
            
            <body>
            
            <script type="text/javascript" src="http://www.iris-studios.com/gkwc/external.php?type=js"></script>
            
            <script type="text/javascript">
            <!--
            	for (var i = 0; i < threads.length; i++)
            	{
            		document.write('<a href="http://www.iris-studios.com/gkwc/showthread.php?t=' + threads[i]['threadid'] + '">' + threads[i]['title'] + '</a> <em>Posted on: ' + threads[i]['threaddate'] + ' by ' + threads[i]['threadtime'] + '</em><br />');
            	}
            //-->
            </script>
            
            </body>
            </html>
            The first bit is the source to your external JS feed:

            HTML Code:
            <script type="text/javascript" src="http://www.iris-studios.com/gkwc/external.php?type=js"></script>
            The second bit cycles through all the syndicated threads and prints out the information. It's just a little simple bit of JavaScript:

            HTML Code:
            <script type="text/javascript">
            <!--
            	for (var i = 0; i < threads.length; i++)
            	{
            		document.write('<a href="http://www.iris-studios.com/gkwc/showthread.php?t=' + threads[i]['threadid'] + '">' + threads[i]['title'] + '</a> <em>Posted on: ' + threads[i]['threaddate'] + ' by ' + threads[i]['threadtime'] + '</em><br />');
            	}
            //-->
            </script>
            Bugdar: PHP bug tracking software that is beautiful, fast, and robust.

            Comment

            • Martell
              Member
              • Dec 2003
              • 32

              #7
              Thanks for this example.

              How can we:

              A) limit the subject length?
              B) specificy a forum id (to pull only content from that forum)
              C) Can I build in a a time factor? (eg. last thirty, sixty days etc).

              The VB manual is SERIOUSLY lacking in how to specify and distribute JS or even RSS feeds.

              With infopoop I created a content island and poof ... done ... here all you get is:



              Don't get me wrong VB rocks infopoop to the stone age, but I'm surprised that the documentation is sooo limited on java or RSS feed syndication.

              Comment

              • Torqued
                Senior Member
                • Oct 2004
                • 125
                • 3.0.5

                #8
                Originally posted by TheMusicMan
                I would like to be able to have users show the last 'n' posts from my www site on their own www sites. How would I go about enabling this and how can I test to see if this works by installing on another of my own sites...?

                What would I need to do on my test site to have this show... how do I do it?

                Cheers
                Have a look at this mod - it allows for more options for exporting your RSS feeds:

                FPS_EXTERNAL.PHP -- New options added & RSS compliant version of external.php

                This is a discussion forum powered by vBulletin. To find out about vBulletin, go to http://www.vbulletin.com/ .


                Also, for distributing your RSS, you may want to consider running through www.feedburner.com and enabling the "SmartFeed" function... you can also get some statistics on your feeds..

                Also, you can include auto-discovery language in your header and it will turn on the RSS icon in the lower corner of Firefox...

                Have a look @ my RSS post on my forum @ http://www.informaticsnurse.com/foru...=1591#post1591

                Comment

                • Totem
                  New Member
                  • Dec 2004
                  • 8

                  #9
                  Following the above scripts, how do i limit the displayed length?
                  How do i limit displayed threads?

                  How do i have the dates in front instead?
                  Can i make a table to seperate the date and thread?

                  Sorry, not so familiar with JS

                  Comment

                  • PcosKat
                    Senior Member
                    • May 2002
                    • 640
                    • 3.7.x

                    #10
                    I have to admit, I still do NOT understand a simple way to do this

                    Comment

                    • jayk
                      New Member
                      • Oct 2003
                      • 13

                      #11
                      Originally posted by PcosKat
                      I have to admit, I still do NOT understand a simple way to do this
                      Because I dont have enough time right now to go through and do all the steps in this thread, I just got ghetto and went here http://www.rss-to-javascript.com/p/138.html

                      plugged in the link and it links it perfectly

                      Comment

                      • bigTex
                        New Member
                        • Apr 2005
                        • 5
                        • 3.0.7

                        #12
                        Feed Per Forum code here

                        I tried a solution for the javascript feed provided by Mirical Bernd (thanks!) and it works perfectly and I am able to move things around, add space, html, etc. with success all around:

                        Code:
                         <b>15 Last Posts in the YOUR_FORUM Forum:
                         <ul> 
                         <script type="text/javascript" src="http://YOUR_FORUM_URL/external.php?type=js&forumids=44"></script>
                         <script type="text/javascript">
                         <!--
                          var max = 15;
                          if(threads.length < max) max = threads.length;
                          for(i = 0; i < max; i++)
                           { 
                        	if (threads[i].title.length > 20)
                        	 { threads[i].title = threads[i].title.substring(0, 30) + '...'; }
                        	document.writeln("<li><a href=\"http://YOUR_FORUM_URL/showthread.php?t=" + threads[i].threadid + "\">" + threads[i].title + "</a> (" + threads[i].poster + " - Posted on: " + threads[i].threaddate + ") </li>");
                           }
                         //-->
                         </script>
                         </ul>
                        I was able to insert this into a php driven page with Smarty {literal} tags and if it works there, it should work elsewhere. I didn't invent this, but there certainly is a lot of bad info regarding JS feeds and using them.The 44 is the forum ID that you want to show the headers for or just drop the &forumids=44.

                        The documentation on external feeds in only worth accessing the data, but what you DO with the feed should also be relevant and discussed in the docs. At least base html examples to get data to show ...

                        - bT

                        Comment

                        • aggiefan
                          Member
                          • Apr 2005
                          • 90
                          • 3.5.x

                          #13
                          Is there a way to use the code above and make the background of each post alternate (like a forum). That would probably involve tables....and I'm pretty dumb. So can somebody help me out?

                          Also, instead of showing the original poster, how can I show the last person who posted?
                          Last edited by aggiefan; Tue 17 May '05, 9:47pm.

                          Comment

                          • VoltageGS
                            New Member
                            • May 2005
                            • 1
                            • 3.0.7

                            #14
                            Originally posted by aggiefan
                            Is there a way to use the code above and make the background of each post alternate (like a forum). That would probably involve tables....and I'm pretty dumb. So can somebody help me out?

                            Also, instead of showing the original poster, how can I show the last person who posted?
                            Not sure how efficient this is, but this is what I used to have alternating colours (you do need to have them in a table). This is using the code supplied by bigTex:

                            HTML Code:
                            <script type="text/javascript" src="http://URL/forums/external.php?type=js&forumids=8"></script>
                            <script type="text/javascript">
                              <!--
                            	var max = 5;
                            	if(threads.length < max) max = threads.length;
                            	for(i = 0; i < max; i++) {
                            	  test = i % 2;
                            	  if (threads[i].title.length > 40) {
                            		threads[i].title = threads[i].title.substring(0, 30) + '...';
                            	  }
                            	  if (test == 0) {
                            	 document.writeln("<tr><td class=\"main_cell\"><a href=\"http://URL/forums/showthread.php?t=" + threads[i].threadid + "\">" + threads[i].title + "</a> (" + "Posted on: " + threads[i].threaddate + " at " + threads[i].threadtime + ") </td></tr>");
                            	  } else {
                            		document.writeln("<tr style=\"background-image: url(/resources/images/interface/shading/grey_pixel.gif);\"><td class=\"main_cell\"><a href=\"http://URL/forums/showthread.php?t=" + threads[i].threadid + "\">" + threads[i].title + "</a> (" + "Posted on: " + threads[i].threaddate + " at " + threads[i].threadtime + ") </td></tr>");
                            	  }
                            	}
                              //-->
                            </script>
                            You could also replace background-image: with background-color: and use a hex value. I used an image to get a specific shade of grey. All it's doing is checking if [i] is an even number (test = i % 2) if it's 0 it's odd, 1 it's even.

                            On another note...this seems to work perfectly in Firefox and IE when in XP SP1 (IE version 6.0.2800.1106), but in XP SP2 (IE version 6.0.2900.2180), it's producing a JavaScript error saying that 'threads' is undefined. Is anyone else seeing this problem or have a fix for it?

                            Comment

                            • dwjngs
                              New Member
                              • Feb 2005
                              • 24
                              • 3.0.0 Release Candidate 4

                              #15
                              Originally posted by daemon
                              Here's a sample way to use JS feeds:
                              Ok, I've been trying to get this to work and it's making me nuts. Here's what I've got going:

                              The javascript external thing is enabled via admin cp. I have a test page here http://www.bccymca.org/javaRSStest.htm with the following code:

                              Code:
                              <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[url="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd[/url]"> <html xmlns="[url="http://www.w3.org/1999/xhtml"]http://www.w3.org/1999/xhtml[/url]"> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <title>External JS Printing</title> </head> <body> <script type="text/javascript" src="<A href="http://www.bccymca.org/forums/external.php?type=js"></script">http://www.bccymca.org/forums/external.php?type=js"></script> <script type="text/javascript"> <!-- for (var i = 0; i < threads.length; i++) { document.write('<a href="[url="http://www.bccymca.org/forums/showthread.php?t='"]http://www.bccymca.org/forums/showthread.php?t='[/url] + threads[i]['threadid'] + '">' + threads[i]['title'] + '</a> <em>Posted on: ' + threads[i]['threaddate'] + ' by ' + threads[i]['threadtime'] + '</em><br />'); } //--> </script> </body> </html>
                              When I call the page I get a blank. It loads alright, and takes a sec to do it, but nothing. I'm trying to insert forum info on the front page of the site, here: http://www.bccymca.org.

                              I'm using XP SP2, IE latest version, FTPVoyager to upload. Any ideas?

                              Thanks.

                              Comment

                              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                              Working...