Page 1 of 1
How to insert 10 last forumposts on startpage?
Posted:
September 7th, 2010, 2:58 pm
by Holger
After i dont got a question in vldpersonals forum, i try here. I can not work with rss and i dont want to. I need a real implementation of forumposts.
I use VLD 2.5.6 and PunBB
Re: How to insert 10 last forumposts on startpage?
Posted:
September 7th, 2010, 6:21 pm
by admin
I google and found nothing for punbb but I found it for phpbb instead ...
maybe you can figure it out if you read this code ...
- Code: Select all
<?php
// How Many Topics you want to display?
$topicnumber = 5;
// Scrolling towards up or down?
$scroll = "up";
// Change this to your phpBB path
$urlPath = "/forum";
// Database Configuration (Where your phpBB config.php file is located)
include 'forum/config.php';
$table_topics = $table_prefix. "topics";
$table_forums = $table_prefix. "forums";
$table_posts = $table_prefix. "posts";
$table_users = $table_prefix. "users";
$link = mysql_connect("$dbhost", "$dbuser", "$dbpasswd") or die("Could not connect");
mysql_select_db("$dbname") or die("Could not select database");
$query = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
FROM $table_topics t, $table_forums f, $table_posts p, $table_users u
WHERE t.topic_id = p.topic_id AND
f.forum_id = t.forum_id AND
t.forum_id != 4 AND
t.topic_status <> 2 AND
p.post_id = t.topic_last_post_id AND
p.poster_id = u.user_id
ORDER BY p.post_id DESC LIMIT $topicnumber";
$result = mysql_query($query) or die("Query failed");
print "<table cellpadding='3' cellSpacing='2' width='170'>";
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "<tr valign='top'><td><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><font color=\"#000000\"><b><a href=\"$urlPath/viewtopic.php?f=$row[forum_id]&t=$row[topic_id]&p=$row[post_id]#p$row[post_id]\" TARGET=\"_blank\">" .
$row["topic_title"] .
"</a></td></font></b><td><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><font color=\"#000000\"> by: <a href=\"$urlPath/memberlist.php?mode=viewprofile&u=$row[user_id]\" TARGET=\"_blank\">" .
$row["username"] .
"</td><td><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"1\"><font color=\"#000000\">" .
date('F j, g:i a', $row["post_time"]) .
"</td></tr></font>";
}
print "</table>";
mysql_free_result($result);
mysql_close($link);
?>
I will try to find a solution for punbb to ... I think the coding is nearly the same for punbb and phpbb but maybe I have wrong about it ... I´m will be back and give you a answer then I know more about it ...
Re: How to insert 10 last forumposts on startpage?
Posted:
September 8th, 2010, 11:15 am
by Holger
thx for reply. i will try to modify the code.
and if it doesnt work ... then maybe i just try phpbb ;-)
Re: How to insert 10 last forumposts on startpage?
Posted:
October 13th, 2010, 7:09 am
by admin
I think I have a solution for this but must try it before I show the code here :!:
have patience ;)
Re: How to insert 10 last forumposts on startpage?
Posted:
October 13th, 2010, 7:18 pm
by admin
thanks emir.smajovic- Code: Select all
<div class="sidebox_wrap">
<h5><span>Forum stats</span></h5>
<div class="sidebox">
<p>
<? echo file_get_contents("http://yoursite/forum/extern.php?action=stats"; >
</p>
</div>
</div>
There is a file extern.php in punbb folder, so only one line of code displays
forum statistics.
Re: How to insert 10 last forumposts on startpage?
Posted:
October 14th, 2010, 1:43 pm
by Holger
White screen :lol:
not sure but i guess you cant put phpcode in the page ... maybe when i make a iframe with a new page with that code
Re: How to insert 10 last forumposts on startpage?
Posted:
October 14th, 2010, 8:16 pm
by admin
I had read some about it seems it will be a conflict with some php coding in some php scripts.
they had solve it with iframe (not recommended) but better doing it that way and get it to work ...
Re: How to insert 10 last forumposts on startpage?
Posted:
January 17th, 2011, 9:42 pm
by db3204
This is so simple to do with RSS. Punbb has RSS feature. All you need is a RSS reader placed in the template you want to display the forums. Go to hotscripts and find a free RSS reader for webpages.