PDA

View Full Version : How To: Add A "Comment On This News (3 Comments)" to a webpage.


nogerorob
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 (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 here (http://www.weeklydavespeak.com/forums/showthread.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 one of my pages (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

nogerorob
08-05-2004, 04:49 AM
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

djr
08-05-2004, 04:15 PM
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.

MGM
08-05-2004, 10:22 PM
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

Highlander
08-08-2004, 09:31 AM
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 ..

nogerorob
08-08-2004, 04:10 PM
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

shawno
08-09-2004, 05:34 AM
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

nogerorob
08-09-2004, 05:40 AM
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 (http://www.weeklydavespeak.com) to see how i'm using it.

r

shawno
08-09-2004, 07:00 AM
Hey Rob,

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

Later

Shawno

nogerorob
08-09-2004, 07:13 AM
You're more than welcome. Please post feel free to post a link if you get a chance to implement it.

r

Yanks1343
08-13-2004, 12:06 AM
This sounds great, but how do I get it to display the post on the main page?

I'd like to display the 3 newest topics..

nogerorob
08-13-2004, 02:20 AM
Let me see if I can figure this out. I'll give it a shot.

rob

Vixion
08-14-2004, 10:57 AM
Okay, I thought YEAH! But I visited you website, and I noticed the following thing;

The 'news' is still posted in a PHP file, included into the main webpage. Isn't there a way, that you can 'insert' the first post of your forum to the news. So you don't ran into problems with no comments, and creating comment page.

nogerorob
08-14-2004, 03:34 PM
I see, so the first comment in the thread would be the content that's inserted into the webpage?

I think this would not be difficult to do, the concern would be making sure that the first post had the proper html/css tags so that when it is inserted into your main page it displays properly.

You can see I am including a php file that contains tables, external style sheet markup and an image. I'm not sure how well this would display in a vB thread. Maybe I'll try it this afternoon.

Would you want the entire contents of the article to be at the head of the thread, or just a summary? In order to refer to a single include from the main page it either has to be complete in the head of the thread.

r

kkiely
12-22-2004, 03:28 AM
Sorry to jump in the middle of this discussion but Imay be able to clarify. I believe people are looking for the comments to come ON the page of the article. This hack can be done - because I already have about 5 requests for it out (including a $100 reward), here https://vborg.vbsupport.ru/showthread.php?t=72007.

An example of what I am lookign for is here
http://www.camcorderinfo.com/content/canon-zr80-camcorder-review.htm

SCROLL TO THE BOTTOM OF THE PAGE

nogerorob
12-22-2004, 05:41 AM
You want it to display the past five newest replies to a given thread? Like the past 5 comments?

Kind of like what IMDB (http://www.imdb.com/title/tt0374900/) does? (scroll to bottom)

I can do this. Let me work on it.

Rob

firstimecaller
05-02-2005, 03:39 PM
are there any more options for this type of system to add comments to existing article/news/story pages? I have lots of articles that exist on their own in separate sections of my site. I'd just like to add the ability to comment on them but this hack seems overly simple. TIA

nogerorob
05-04-2005, 12:30 AM
Heh, easy on the "overly simple" stuff.

You can use this code to add to existing pages. You simply need to create the corresponding threads, or use the threadID from an old discussion on the particular aritcle / news item.

See it in action: www.weeklydavespeak.com (http://www.weeklydavespeak.com).

r

ps. as a brief aside, I haven't done the last 5 replies hack yet--but I still intend to.

kkiely
05-04-2005, 01:13 AM
what I am looking for is where the comment are shown under the actual story - not the way IMDB does it but the way TechIMO does it. They actually use a commercial program called ReviewPost which is only $100. Considering I have posted a paid request for a hack here and on rent-a-coder for $100 and got no interest I think I will buy reviewpost until a VB hack comes out.

http://www.techimo.com/newsapp/index.pl?photo=13877

Their front page still has the format of "ARTICLE TITLE (3 comments)"

deathemperor
05-06-2005, 02:23 PM
if a page is included the global.php it will basicly add 5 queries if I am right.

then why don't you just make it like a vbulletin page, that way it's easier to change the look (by editing the template). also easier to make the page become more complex.

kkiely
05-09-2005, 10:17 PM
"then why don't you just make it like a vbulletin page"

because every single installation of a VBulletin CMS (VBadvanced, VBPortal) looks exactly the same. Those boxes are ugly. I'm looking for a way to port threads on to a non-VB page.

nogerorob
05-11-2005, 03:53 AM
"then why don't you just make it like a vbulletin page"

because every single installation of a VBulletin CMS (VBadvanced, VBPortal) looks exactly the same. Those boxes are ugly. I'm looking for a way to port threads on to a non-VB page.

Bless your heart for saying this. You are right.

I stay away from vB CMS's because every site looks the damn same. I don't think that they catch the same kind of search engine attention as home brewed ++++e either--the URL's are all screwy.

Don't worry, I'm going to figure this shizzle out and post it. PM me and maybe we can work together.

r

BenSkiddle
05-15-2005, 03:56 PM
This sounds interesting

EINS
06-18-2005, 08:10 PM
because every single installation of a VBulletin CMS (VBadvanced, VBPortal) looks exactly the same.

so tell me what do you think about this

http://www.cgtalk.ru/

nogerorob
06-19-2005, 05:51 PM
That's a good looking site, (though i can't read it). If that is based on a Vb cms, I'd say it is an exception to the rule.

EINS
06-19-2005, 06:12 PM
Its vBAdvanced CMPS (Look at the bottom of the Site). It shows how vBA can look if you have creativity.

scotsmist
06-27-2005, 11:47 AM
<a href="http://www.vizdepot.com/" target="_blank">http://www.vizdepot.com/</a> is running vbportal 3.0.x

freakify
06-30-2005, 09:37 AM
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/.
I'm sorry for asking this, but what if my forums are in a subdomain (forums.domain.com) ? Will this work on my www.domain.com? If all I have to do is change the above code, what's the correct way?

Thanks

nogerorob
11-14-2006, 02:51 AM
I'm sorry for asking this, but what if my forums are in a subdomain (forums.domain.com) ? Will this work on my www.domain.com? (http://www.domain.com?) If all I have to do is change the above code, what's the correct way?
Thanks
Hey there,
I'm over a year late, I thought I was subscribed to this thread but apparently not. I hope you got this working.

rob

azjr247
06-17-2007, 02:10 PM
Sweet! i had been looking for something like this! Hope it works on the latest build!!! Thanks for posting this!

Shaliza
12-26-2007, 12:02 PM
Great little script! Getting the actual comments on the non-vB page will be easy.

Shaliza
03-11-2008, 10:08 PM
Ever since vB was upgraded, this doesn't work.

Anyone else having a problem with it?

sedline
05-11-2008, 04:50 AM
wooouuuw thats it !!!


Thanks :)