Go Back   vb.org Archive > vBulletin Modifications > vBulletin 3.8 Modifications > vBulletin 3.8 Template Modifications
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
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
Version: 1.00, by Spinball Spinball is offline
Developer Last Online: Oct 2023 Show Printable Version Email this Page

Category: Integration with vBulletin - Version: 3.8.2 Rating:
Released: 04-13-2009 Last Update: Never Installs: 4
Template Edits
Re-useable Code Translations  
No support by the author.

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 AVForums.com/reviews and my forums are in AVForums.com/forums.

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:
Quote:
$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,"http://www.avforums.com/reviews/showcomments.php?t=" . $review['threadid'] . "&page=9999");
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1) ;
$comments = curl_exec($curl_handle);
curl_close($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:
Quote:
$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.

Screenshots

File Type: jpg Image1.jpg (139.5 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 04-14-2009, 05:10 PM
Jasem's Avatar
Jasem Jasem is offline
 
Join Date: Feb 2006
Location: www.menokia.com
Posts: 594
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice work, thank you!
Reply With Quote
  #3  
Old 05-28-2009, 08:12 PM
CMFINC CMFINC is offline
 
Join Date: Feb 2007
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
  #4  
Old 05-28-2009, 08:26 PM
nnStaff nnStaff is offline
 
Join Date: May 2009
Posts: 47
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

pretty nifty
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 02:29 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05897 seconds
  • Memory Usage 2,250KB
  • Queries Executed 18 (?)
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
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (3)postbit
  • (1)postbit_attachment
  • (4)postbit_onlinestatus
  • (4)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