How to insert 10 last forumposts on startpage?

Please only post questions about mods, extensions, themes, languages and tutorials. for other technical question please use vldPersonals forum instead.

How to insert 10 last forumposts on startpage?

Postby Holger » September 7th, 2010, 2:58 pm

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
Holger
 
Posts: 3
Joined: 24 Aug 2010
Location: Haderslev - Denmark

Re: How to insert 10 last forumposts on startpage?

Postby admin » September 7th, 2010, 6:21 pm

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 ...
//gugu
Admin VldMods Forum
User avatar
admin
Site Admin
 
Posts: 105
Joined: 13 Aug 2010
Location: sweden
Knowledge: 6
Vld Version: 2.7
Vld Site: http://www.love2u.se

Re: How to insert 10 last forumposts on startpage?

Postby Holger » September 8th, 2010, 11:15 am

thx for reply. i will try to modify the code.
and if it doesnt work ... then maybe i just try phpbb ;-)
Holger
 
Posts: 3
Joined: 24 Aug 2010
Location: Haderslev - Denmark

Re: How to insert 10 last forumposts on startpage?

Postby admin » October 13th, 2010, 7:09 am

I think I have a solution for this but must try it before I show the code here :!:
have patience ;)
//gugu
Admin VldMods Forum
User avatar
admin
Site Admin
 
Posts: 105
Joined: 13 Aug 2010
Location: sweden
Knowledge: 6
Vld Version: 2.7
Vld Site: http://www.love2u.se

Re: How to insert 10 last forumposts on startpage?

Postby admin » October 13th, 2010, 7:18 pm

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.
//gugu
Admin VldMods Forum
User avatar
admin
Site Admin
 
Posts: 105
Joined: 13 Aug 2010
Location: sweden
Knowledge: 6
Vld Version: 2.7
Vld Site: http://www.love2u.se

Re: How to insert 10 last forumposts on startpage?

Postby Holger » October 14th, 2010, 1:43 pm

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
Holger
 
Posts: 3
Joined: 24 Aug 2010
Location: Haderslev - Denmark

Re: How to insert 10 last forumposts on startpage?

Postby admin » October 14th, 2010, 8:16 pm

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 ...
//gugu
Admin VldMods Forum
User avatar
admin
Site Admin
 
Posts: 105
Joined: 13 Aug 2010
Location: sweden
Knowledge: 6
Vld Version: 2.7
Vld Site: http://www.love2u.se

Re: How to insert 10 last forumposts on startpage?

Postby db3204 » January 17th, 2011, 9:42 pm

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.
db3204
 
Posts: 5
Joined: 03 Oct 2010
Knowledge: 1
Vld Version: 2.5.3
Vld Site: http://www.filipinaeyes.com


Return to Questions & Answers

Who is online

Users browsing this forum: No registered users and 1 guest

cron