Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > General Articles

Reply
 
Thread Tools
How To: Add A "Comment On This News (3 Comments)" to a webpage.
nogerorob
Join Date: Jun 2004
Posts: 82

 

Portland, OR
Show Printable Version Email this Page Subscription
nogerorob nogerorob is offline 07-21-2004, 10:00 PM

Hello,

If you have a website that you would like to connect your content directly to discussions on your bulletin board, you might enjoy this little hack. Basically it lets your users get directly into commenting on your content, and see immediatly how many people have commented so far.

It doesn't require any editing of vBulletin, to see it in action, check out my main page.


---------------------------------------------------------------

First you need to create a forum thread about the web page you have created. It helps to have a short blurb from the article or news item and a link back to the page in the first post.

See here for an example. You can also see how I?ve organized a Forum Section for News, Articles and Davespeak to reflect different content areas on my site.

I?ve attached two files:

commentLine.php goes in some directory on your server. I put mine in a /SharedCode/php/ dir, but anywhere is fine. The only modification needed in this file is the chdir($_SERVER["DOCUMENT_ROOT"]."/forums/"); to whatever your forums directory is. i.e. /boards/ or /forum/.


example_content.php file is an example of how to use the commentLine.php script on one of your html pages.



Here are the changes that need to be made each time you want to place a Comment On This line:
1. Change the /PATH_TO_COMMENTLINE.PHP/ enter the path from the root of your public_html dir to the commentLine.php directory.

i.e.: "/ServerScripts/php/commentLine.php") ?>

2. In the PHP code at the bottom:
A. Change X to the thread ID of the forum you create on your vBulletin forum.

B. Change the URL to the the thread you create in your vBulletin forum.

C. Change "News" to whatever the above content is describing, article, forum, study, etc.
To see how I use this script, check out one of my pages

I don't know if this requires a database query, which might be important if your webpages are getting tons of page views. It is only calling one function from vB.

Rob
Attached Files
File Type: php commentLine.php (1.1 KB, 106 views)
File Type: php example_content.php (568 Bytes, 81 views)
Reply With Quote
  #2  
Old 08-05-2004, 04:49 AM
nogerorob nogerorob is offline
 
Join Date: Jun 2004
Location: Portland, OR
Posts: 82
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So, a fair number of people have checked this out--but no comments. Anyone find a use for this little thing?

It might be worth noting that this has helped get over 300 people registered in the first 9 days of the board.

rob
Reply With Quote
  #3  
Old 08-05-2004, 04:15 PM
djr's Avatar
djr djr is offline
 
Join Date: Nov 2001
Location: Amsterdam
Posts: 220
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I would be *VERY* interested in using this hack, but it misses two vital parts imho .. it would be more clever to insert the blurb of the article (the intro section) as the first post of a new thread in a designated forum and then automatically return the threadid (and any other needed variables) in the commentline.php. This would make THE perfect addition for any news site, without the need for a portal.
Reply With Quote
  #4  
Old 08-05-2004, 10:22 PM
MGM MGM is offline
 
Join Date: Jan 2003
Location: Michigan
Posts: 245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by djr
I would be *VERY* interested in using this hack, but it misses two vital parts imho .. it would be more clever to insert the blurb of the article (the intro section) as the first post of a new thread in a designated forum and then automatically return the threadid (and any other needed variables) in the commentline.php. This would make THE perfect addition for any news site, without the need for a portal.
I agree... I've been looking for something like this for a while *adds thread to favorites* I'll check back and see if it can be done

MGM out
Reply With Quote
  #5  
Old 08-08-2004, 09:31 AM
Highlander Highlander is offline
 
Join Date: Apr 2002
Posts: 188
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hey that look good .. i use something llike this:
http://spieleplanet.com/board/view.php?pg=gamenews but in this kind of cms attachments and images are not able to show up ..

is yours dynamically?
i just need something what would read out a specific forumid and show up the first posts with the first attachment within posted in the post ..

in you example files i can only specify threadids ..
Reply With Quote
  #6  
Old 08-08-2004, 04:10 PM
nogerorob nogerorob is offline
 
Join Date: Jun 2004
Location: Portland, OR
Posts: 82
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey there,

It is dynamic in that the number of replies is updated on the fly. It is not set up to read the most recent reply's subject or attachement if it exists. I could write this though. Could you be a little more clear--you want the last few posts in a specific thread, and their attachements?

rob
Reply With Quote
  #7  
Old 08-09-2004, 05:34 AM
shawno shawno is offline
 
Join Date: Jul 2004
Location: London
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Rob,

Great hack. Just a question though - what happens the first time when no one has created a comment. Is the thread already created? Or does the first person who comes to comment have to enter a title for the thread?

Have to agree with 'DJR''s comments earlier as well.

Good stuff!

Later

Shawno
Reply With Quote
  #8  
Old 08-09-2004, 05:40 AM
nogerorob nogerorob is offline
 
Join Date: Jun 2004
Location: Portland, OR
Posts: 82
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey Shawno,

You must create the thread first. On my site i have a special "news" forum where these are located. I disallow general users from creating new threads.

If no one has replied to the thread I've created, it says "Comment on this news (0 comments)"

What I've found is that if someone posts a thread in another forum that I end up developing into a news story, I can move the thread into the news forum, and merge it with the "official" news thread. I had to do this recently, it works like a charm.

Again, check out my main page to see how i'm using it.

r
Reply With Quote
  #9  
Old 08-09-2004, 07:00 AM
shawno shawno is offline
 
Join Date: Jul 2004
Location: London
Posts: 22
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey Rob,

Thanks for that. I think this little hack could be rather useful. Nice work.

Later

Shawno
Reply With Quote
  #10  
Old 08-09-2004, 07:13 AM
nogerorob nogerorob is offline
 
Join Date: Jun 2004
Location: Portland, OR
Posts: 82
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You're more than welcome. Please post feel free to post a link if you get a chance to implement it.

r
Reply With Quote
Reply

Thread Tools

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 01:57 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.04851 seconds
  • Memory Usage 2,298KB
  • Queries Executed 24 (?)
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)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (2)postbit_attachment
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete