PDA

View Full Version : Has anyone already written a News log script or something similar?


06-26-2000, 12:08 AM
Hi,

I'm looking for a PHP script which displays the first 30 lines (or so) of every topic from a forum, which I dedicated to News, on the front page of our web site.
Only moderators or admins can post new threads (the News articles) all other can only comment on them. I would like to have a link "Read more" below of every 30 lines excerpt pointing to the full article and a link "Comments" pointing to the full discussion thread.

I've seen the Active Topics script and probably I could use it as a starting point but I would also like to have the vB-Code support, Smilie support and automatic web address parsing etc.. which the vB scripts have, not just plain text. And then it gets difficult for me since I'm new to PHP.

Does anyone have already written such a PHP script or could give me other useful pointers for writing such a beast?

Thanks in advance

06-26-2000, 04:27 AM
Yes this would be great!

06-29-2000, 08:05 AM
would not know how to do this, but it sound greate

- especialy with an option of "last post" in a tread instet of first post.

06-29-2000, 08:18 AM
take the script you meantioned, and modify it a bit. It should not be too hard.

basically, you have a script with these functions:

-connect to db
-get threadid's of the threads you want displayed (date limit?)
-parse the text of the threads and misimise to 30 lines (better do 60 words or so)
-output the text

06-29-2000, 09:19 AM
I've already written such a news log (also called weblog) script myself now.
Yesss... :)

I used forumdisplay.php and showthread.php as a starting point, a lot of copy and paste (really a lot), some new templates etc. and it's already working - including support for vB code, similies etc.. I had some problems calling the script from within the front page (index.html) of the web site instead of inside the vB folder but I could fix that (there were slight changes to global.php necessary).

I noticed also that I had no clear idea how to show the 'first few lines' since the line number depends on the HTML formatting. Counting sentences or words wasn't a good idea either because some news writers here wanted to determine the size of the intro text by themselves. So I added support for a tag '{RM}' which tells my script to stop printing the text and instead it creates a link pointing to the article (i.e. to the top of the thread). The text for this link just reads 'Read more...' + a 'Commments(n)' link where n is the number of replies to the news article.
The news writer has to insert such a {RM} tag himself in the article which is ok for me.

If somebody is interested I would release the script after some cleanup. I'm a PHP beginner so it's not very clean yet - it's more or less copy&paste from the vB scripts. So there is a lot of redundant stuff in there etc.. It might also be that it works only with PHP4 for some reasons.

BTW, I'm glad that I bought the vB and not one of those unreadable Perl based forum systems because after 4 days playing around with PHP I think PHP is pretty cool. :cool: You can start progamming within one day if you know some C.

07-07-2000, 10:20 AM
I'd love to have this hack if you release it. This would be the ideal way of including news items on my front page...

thanks!