Back to General Articles

How To: Add A "Comment On This News (3 Comments)" to a webpage.
by nogerorob 22 Jul 2004

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 http://www.weeklydavespeak.com.

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

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 http://www.weeklydavespeak.com/forums/index.php?t=11 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 http://www.weeklydavespeak.com/news/DMBFestival_SF_072004.php

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, 108 views)
File Type: php example_content.php (568 Bytes, 83 views)

vblts.ru supports vBulletin®, 2022-2024