Register Members List Search Today's Posts Mark Forums Read

Mod Options
Displaying the latest posts from a thread in an external page for reviews/news Details »
Displaying the latest posts from a thread in an external page for reviews/news
Mod Version: 1.00, by Spinball (Member) Spinball is offline
Developer Last Online: Jan 2022 I like it Show Printable Version Email this Page

vB Version: 3.8.2 Rating: (0 vote - 0 average) Installs: 4
Released: 14 Apr 2009 Last Update: Never Downloads: 1
Not Supported Template Edits Re-usable Code Translations  

We publish movie and hardware reviews using their own databases and CMS style scripts I created. I wanted to incorporate discussions related to those reviews along side them. I have wanted to do this for ages, but only just cracked it and I thought I would share my findings here.

Hopefully a moderator will move this thread if it is in the wrong forum.

Ok firstly I am displaying a discussion thread in web pages external to my forums but on the same server. That's the first restriction.
Also since I have vBSEO installed, the page *has* to be in a different folder than my forums otherwise vBSEO redirects calls to my page to the forums instead.
Ok, so my reviews are in and my forums are in

I need to link a discussion thread to each review and a threadid field in the review table allows that.
I could manually create a thread for each review and then update the threadid in the review, but it can be done automatically.
I have created an RSS feed for our reviews and I'm using the vBulletin RSS to thread functionality to automatically create a new thread within an hour of a new review being published. Since I know what the title of the automatically created thread will be, and what forum it will be in, I can interrogate the thread table to find the threadid and write it into the review. I wrote a script to do this and a cron job to fire it every hour. Easy.

So now we have our review and our discussion thread and the threadid is stored in the review record.
Now all we have to do is display the last page of the discussion thread in our review. Since our reviews are split into tabs, I created a new 'Comments' tab for this purpose.

Next I created a new template called SHOWTHREAD_embedded and copied the contents of the SHOWTHREAD template into it. I then removed all the elements of the page I don't want like the <body> tags and everything outside of them along with some of the buttons and the moderation and menu elements. I don't need this stuff since it's a basic comments page with limited functionality. Don't want to over complicate things.

Then I made a copy of showthread.php called showcomments.php, changed the 2 references to the SHOWTHREAD template to SHOWTHREAD_embedded and saved into my reviews folder. This script can be tested directly by running /reviews/showcomments.php?t=123456 with any thread id replacing 123456. It returns the thread as you'd expect with no style applied (since we removed it from the template).

The last step is running the showcomments script when someone clicks the Comments tab on my review pages.
I use curl to do this:
curl_setopt($curl_handle,CURLOPT_URL,"" . $review['threadid'] . "&page=9999");
$comments = curl_exec($curl_handle);
And display $comments in your page.
Note that the page=9999 ensures you display the last page of your thread.

We do have an issue with the relative links used in the SHOWTHREAD_embedded template bring broken since we are in the reviews folder rather than the forums folder.
But since we have the comments in a string variable $comments, we can do some string replaces to fix these:
$comments = str_replace("<img src=\"customavatars/" , "<img src=\"../forums/customavatars/" , $comments);
$comments = str_replace("href=\"newreply.php" , "href=\"../forums/newreply.php" , $comments);
$comments = str_replace("href=\"showpost.php" , "href=\"../forums/showpost.php" , $comments);
$comments = str_replace("href=\"member.php" , "href=\"../forums/member.php" , $comments);
$comments = str_replace("href=\"showthread.php" , "href=\"../forums/showthread.php" , $comments);
And it works well.
I know it's very possibly inefficient and there are likely some things that could be done better, but even with my extremely limited knowledge of how vB works, I had it working in a couple of hours.
Any suggestions on how to improve it are welcome.
I hope this info helps someone.

Download Now

Only licensed members can download files, Click Here for more information.


Click image for larger version

Name:	Image1.jpg
Views:	871
Size:	139.5 KB
ID:	97767  

Show Your Support

  • To receive notifications regarding updates -> Click to Mark as Installed.
  • If you like this modification support the author by donating.
  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Old 14 Apr 2009, 18:10
Jasem's Avatar
Jasem Jasem is offline
Join Date: Feb 2006
Nice work, thank you!
Forum Nokia
Reply With Quote
Old 28 May 2009, 21:12
CMFINC CMFINC is offline
Join Date: Feb 2007
you think this could be mod-ed to make a Automatic Discussion Thread? our site deals with program files in diff forums.. and really would like to have auto discussion thread posted when a file is posted.
thank you for any help or ideals
Reply With Quote
Old 28 May 2009, 21:26
nnStaff nnStaff is offline
Join Date: May 2009
pretty nifty
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Mod Options

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

New To Site? Need Help?

All times are GMT. The time now is 09:15.

Layout Options | Width: Wide Color: