Web Wiz - Solar Powered Eco Web Hosting

  New Posts New Posts RSS Feed - Mod: Display Recent Posts (anywhere)
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Mod: Display Recent Posts (anywhere)

 Post Reply Post Reply Page  123 4>
Author
 Rating: Topic Rating: 1 Votes, Average 4.00  Topic Search Topic Search  Topic Options Topic Options
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9791
Post Options Post Options   Thanks (1) Thanks(1)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Topic: Mod: Display Recent Posts (anywhere)
    Posted: 01 July 2007 at 12:38pm
This mod (which will be included as an extra in version 9) will allow you to display recent posts from your forum in other pages and even other websites using the Web Wiz Forums built in RSS Feed.

Just place the code below into any ASP page, on any website, where you want the recent posts to be displayed, it will then grab the most recent posts from your forums RSS Feed:-

<%


Dim objXMLHTTP        'MS XML Object
Dim objRSSFeedItem    'XML Feed Items
Dim sarryRSSFeedItem    'RSS Feed array
Dim strHTML        'HTML Table results
Dim strWebWizForumsURL    'Web Wiz Forums RSS Feed
Dim intTimeToLive    'Time to live in minutes


'Holds the URL to the Web Wiz Forums RSS Feed
strWebWizForumsURL = "http://forums.webwiz.net/RSS_topic_feed.asp"


'Time to live (how long the RSS Feed is cached in minutes)
'0 will reload immediately, but place more strain on the server if the page is called to often
intTimeToLive = 10

%>
<table class="tableBorder" cellspacing="0" cellpadding="0" width="100%">
 <tr class="tableLedger">
  <td><strong>Recent Forum Posts</strong></td>
 </tr><%

'If this is x minutes or the feed is not in the web servers memory then grab the feed
If DateDiff("n", Application("rssWebWizForumsUpdated"), Now()) >= intTimeToLive Then

  
    'Create MS XML object
    Set objXMLHTTP = Server.CreateObject("MSXML2.FreeThreadedDOMDocument")
   
    'Set the type of request HTTP Request
    objXMLHTTP.setProperty "ServerHTTPRequest", True
   
    'Disable Asyncronouse response
    objXMLHTTP.async = False
   
    'Load the Web Wiz Forums RSS Feed
    objXMLHTTP.Load(strWebWizForumsURL)
   
    'If there is an error display a message
    If objXMLHTTP.parseError.errorCode <> 0 Then Response.Write "<strong>Error:</strong> " & objXMLHTTP.parseError.reason
     
    'Create a new XML object containing the RSS Feed items
    Set objRSSFeedItem = objXMLHTTP.getElementsByTagName("item")
   
    'Loop through each of the XML RSS Feed items and place it in an HTML table
    For Each sarryRSSFeedItem In objRSSFeedItem
   
        'Web Wiz Forums RSS Feed Item childNodes
        '0 = title
        '1 = link
        '2 = description (post)
        '3 = pubDate
        '4 = guid (perminent link)
          
        strHTML = strHTML & " <tr class=""tableRow"">" & _
        vbCrLf & "  <td>" & _
        vbCrLf & "   <a href=""" & sarryRSSFeedItem.childNodes(1).text & """ title=""Posted: " & sarryRSSFeedItem.childNodes(3).text & """>" & sarryRSSFeedItem.childNodes(0).text & "</a>"
       
        'If you wish to display the entire post, uncomment the line below
        'strHTML = strHTML & vbCrLf & "   <br />" &  sarryRSSFeedItem.childNodes(2).text & "<br /><br />"
       
        strHTML = strHTML & vbCrLf & "  </td>"
       
    Next
   
    'Release the objects
    Set objXMLHTTP = Nothing
    Set objRSSFeedItem = Nothing
   
    'Stick the whole lot in a application array to boost performance
    Application.Lock
    Application("rssWebWizForumsContent") = strHTML
    Application("rssWebWizForumsUpdated") = Now()
    Application.UnLock
End If

'Display the Web Wiz Forums Posts in an HTML table
Response.Write(Application("rssWebWizForumsContent"))
%>
 </tr>
</table>

Change the URL in red to your own Web Wiz Forums RSS Feed.

The feed is cached and updates every 10 minutes to prevent strain on your server, but you can change this value to any you want, in minutes by changing the value in red.

This displays just the subjects as links to the actual post. If you wish to display the entire post, uncomment the line in blue.


Edited by -boRg- - 22 July 2007 at 4:21pm
Back to Top
javi712 View Drop Down
Senior Member
Senior Member


Joined: 22 May 2003
Location: United States
Status: Offline
Points: 488
Post Options Post Options   Thanks (0) Thanks(0)   Quote javi712 Quote  Post ReplyReply Direct Link To This Post Posted: 01 July 2007 at 11:12pm
thanks!
Back to Top
Praveen View Drop Down
Senior Member
Senior Member
Avatar

Joined: 09 December 2005
Location: India
Status: Offline
Points: 218
Post Options Post Options   Thanks (0) Thanks(0)   Quote Praveen Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2007 at 2:17am
Can this be used for version 8.04??
Back to Top
iSec View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 February 2005
Status: Offline
Points: 1140
Post Options Post Options   Thanks (0) Thanks(0)   Quote iSec Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2007 at 4:11am
This is not working for me, I changed the line in red but it's still displaying webwiz forums' RSS feed and not my forum's feed!
"When it gets dark enough, you can see the stars"
-Charles A. Beard
Back to Top
javi712 View Drop Down
Senior Member
Senior Member


Joined: 22 May 2003
Location: United States
Status: Offline
Points: 488
Post Options Post Options   Thanks (0) Thanks(0)   Quote javi712 Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2007 at 4:14am
I don't think its the script Info_Tech, I tried it on my site and it works fine.
Back to Top
billd3 View Drop Down
Senior Member
Senior Member


Joined: 19 February 2003
Location: United States
Status: Offline
Points: 530
Post Options Post Options   Thanks (0) Thanks(0)   Quote billd3 Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2007 at 4:59am
Originally posted by Info_Tech Info_Tech wrote:

This is not working for me, I changed the line in red but it's still displaying webwiz forums' RSS feed and not my forum's feed!
 
Same here!
Here's my test page, and I DID change the URL in the sample code above.
 
We have 8.06, or whatever the LATEST is, is there a problem in the code in the forum itself?


Edited by billd3 - 02 July 2007 at 5:00am
BillD
http://theamcpages.com
http://theamcforum.com
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9791
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2007 at 7:14am
Originally posted by Praveen Praveen wrote:

Can this be used for version 8.04??

It will work with any version of Web Wiz Forums that has an RSS Feed.

Infact, this will work with almost any RSS Feed, not just a Web Wiz Forums RSS Feed. For example put in the BBC News RSS Feed URL and it would display that.
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9791
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2007 at 7:18am
Originally posted by Info_Tech Info_Tech wrote:

This is not working for me, I changed the line in red but it's still displaying webwiz forums' RSS feed and not my forum's feed!

To reduce strain on the server it caches the feed for 10 minutes. Change the 'intTimeToLive = 10' number to 0 and it will force the server to reload it's cache.
Back to Top
 Post Reply Post Reply Page  123 4>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.07
Copyright ©2001-2024 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Policy

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2024 Web Wiz Ltd. All rights reserved.