Hi,
I was looking for a simple solution for displaying forum posts on the front page of a site - nothing bloated like bolting on a CMS - but despite searching through the forums, I was unsuccessful. As a result, I decided to hack the extern.php to do this.
It works pretty much the same way as extern.php works:
- just drop externnews.php into our forum directory, and include (as per extern.php)
- use action=new or active (but it would probably make sense to only use new)
- use fid to limit to one forum only
- Displays first paragraph of text only
- Does parsing of bbcode in text
- uses <div class="..."></div> CSS styles to display different sections. Define these in your stylesheets to format them the way you want.
newsdateheader = date header for grouping posts by date
newsheading = news heading
newstext = actual post text
newstagline = the poster name and time of post
Todo:
- RSS part doesn't work, I've only done the HTML display at the moment
- Perhaps display posts from multiple forums (category maybe??)
- Improve db queries (I copied and pasted form viewtopic.php)
- Parsing of smilies doesn't quite work - image location is wrong //** Edit This can be fixed by copying the /forums/img/ directory to wherever you plan to use this script
Anyway, let me know how you go with this one. I'm by no means a php programmer, and as I said before, this is just a hack I put together. Please feel free to share your knowledge and improve on it (especially the RSS and smilies bit)...
Demo at: http://shuttertalk.com
Download from: http://shuttertalk.com/externnews.zip
Version history:
- 2004-06-02: changed display of posts, and added number of replies
- 2004-06-23: fixed "order by" bug on line 266
Enjoy!
Jules