1 (edited by Mr Puto 2006-05-05 23:00)

Topic: PunBB News

##
##
##          Mod title:  PunBB News System
##
##        Mod version:  1.0
##          For PunBB:  1.2.*
##              Date :  5/5/06
##             Author:  Alex Capek (i.is.alex@hotmail.com)
##
##        Description:  This mod changes your index.php into a nice mini-portal with News displayed. PLEASE READ BELOW CAREFULLY
##
##     Files affected:  viewtopic.php, viewforum.php
##
##        DB Affected:  no
##
##       Info: YOU NEED TO DO SOME EDITING. If you want the newest topic to be displayed in the header, then upload header.php along with the other files, otherwise, don't.
##       You need to specify what forum to grab the news out of, this is set to 1 at default, open index.php and change $newsid to whatever you need to.
##       Last thing is how many announcements are displayed at a time, default is 5. Change $newsamount to whatever you need to in index.php.
##
##

Credit to Reines for help.
Download here

Re: PunBB News

sweet, work.. i took it one step father.. thanks for the code...
http://bunpai.com

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

3

Re: PunBB News

very nice modification smile this same modification is used over at stealingyour.info. Im currently using this mod at my forums. For those of you who want an idea of what it looks like can check it out at my forums. www.fatalgamers.org

4

Re: PunBB News

quaker wrote:

sweet, work.. i took it one step father.. thanks for the code...
http://bunpai.com

One suggestion would be to shorten these literals:
    Total number of registered users: 1
    Total number of topics: 2
    Total number of posts: 3

Look in /lang/English/index.php for what to change.

I use the Minima look for my forum also: http://hcgtv.net/

Re: PunBB News

well i wanted to get away from the typical nuke feel of a frontpage or a cms
that is why im working my punbb into a css template.
same old punbb as the backbone. but....
totally different look ..

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: PunBB News

Np guys, tell me if you have any problems.

Re: PunBB News

good work! smile

ERROR - MIRROR

Re: PunBB News

Mr Puto, thanks for the mod.. it is kewl.. I ws looking for something like this for my site.
I just needed a few codeds from ya new _punbb
thanks!

Q

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: PunBB News

i'd really love to use this mod, but it doesn't work for me..

Parse error: syntax error, unexpected $end in D:\temp\_web\punbb\index.php on line 182

any idea?

thx in advance

Re: PunBB News

You forgot a } somewhere wink

11

Re: PunBB News

i just copied a few lines..hehe...

<?php

define('PUN_ROOT', './');
define('PUN_QUIET_VISIT', 1);
require PUN_ROOT.'include/common.php';
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'lang/'.$pun_user['language'].'/index.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/common.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/topic.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/login.php';
require PUN_ROOT.'include/parser.php';

$page_title = pun_htmlspecialchars($pun_config['o_board_title']);
define('PUN_ALLOW_INDEX', 1);

$newsid = '1'; //This is the forum the news is retrieved from
$newsdisplay = '5'; //This is how many news articles are displayed.

if ($pun_config['o_users_online'] == '1')
{
    // Fetch users online info and generate strings for output
    $num_guests = 0;
    $users = array();
    $result = $db->query('SELECT user_id, ident FROM '.$db->prefix.'online WHERE idle=0 ORDER BY ident', true) or error('Unable to fetch online list', __FILE__, __LINE__, $db->error());

    while ($pun_user_online = $db->fetch_assoc($result))
    {
        if ($pun_user_online['user_id'] > 1)
            $users[] = "\n\t\t\t\t".'<dd><a href="profile.php?id='.$pun_user_online['user_id'].'">'.pun_htmlspecialchars($pun_user_online['ident']).'</a>';
        else
            ++$num_guests;
    }

    $num_users = count($users);
}

$result = $db->query('SELECT COUNT(id)-1 FROM '.$db->prefix.'users') or error('Unable to fetch total user count', __FILE__, __LINE__, $db->error());
$stats['total_users'] = $db->result($result);

$result = $db->query('SELECT id, username FROM '.$db->prefix.'users ORDER BY registered DESC LIMIT 1') or error('Unable to fetch newest registered user', __FILE__, __LINE__, $db->error());
$stats['last_user'] = $db->fetch_assoc($result);

$result = $db->query('SELECT SUM(num_topics), SUM(num_posts) FROM '.$db->prefix.'forums') or error('Unable to fetch topic/post count', __FILE__, __LINE__, $db->error());
list($stats['total_topics'], $stats['total_posts']) = $db->fetch_row($result);
?>

Then you need to add this code to where you want the topics posted

<p class="page_title"><div class="blockform" >
        <p class="page_title">Latest News</p><p></p>
        <div class="clearer">
                <table>
                    <tr>
                        <td>
                            <?
                                $result = $db->query('SELECT t.id, t.subject, t.forum_id, p.poster, p.poster_id, p.message, p.hide_smilies, p.posted, g.g_title, f.forum_name FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON p.topic_id=t.id AND p.posted=t.posted INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id LEFT JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id WHERE t.forum_id='.$newsid.' AND t.moved_to IS NULL AND f.redirect_url IS NULL ORDER BY t.posted DESC LIMIT '.$newsdisplay) or error('Unable to fetch announcements', __FILE__, __LINE__, $db->error());
                   
                    if ($db->num_rows($result))
                    {
                            while($cur_post = $db->fetch_assoc($result))
                            {
                                    $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
                                echo "\t\t\t\t\t\t\t".'<p><strong><a href="forum.php">Forum</a> » <a href="viewforum.php?id='.$cur_post['forum_id'].'">'.pun_htmlspecialchars($cur_post['forum_name']).'</a> » <a href="viewtopic.php?id='.$cur_post['id'].'">'.pun_htmlspecialchars($cur_post['subject']).'</a></strong> - Posted '.format_time($cur_post['posted']).' <span class="byuser'.(isset($cur_post['g_title']) ? ' '.strtolower(str_replace(' ', '', $cur_post['g_title'])) : '').'"><strong> » </strong><a href="profile.php?id='.$cur_post['poster_id'].'" class="username">'.pun_htmlspecialchars($cur_post['poster']).'</a></span></p>'."\n";
?>
                                <div class="clearer">
                                    <?php echo $cur_post['message']."\n" ?>
                                </div>
                                <br />
                                <?php
                                if ($cur_post['poster_id'] == $pun_user['id'] || $pun_user['g_id'] < PUN_GUEST)
                                {
                                    echo '<span style="float:right"><a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a> | <a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a></span>';
                                }
                                ?>
                            <br />
                            <?
                            }
                        }
                        else
                        {
                            echo 'No news';
                        }   
                            ?>                   
                        </td>
                    </tr>
                </table>
                                         
           
           
        </div>

http://bunpai.com

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: PunBB News

elbekko wrote:

You forgot a } somewhere wink

that was also my first impression, but i checked the code 3 times.. and as far as i saw everything was ok.. hmm

@quaker is this your index.php?

13

Re: PunBB News

part of it
i got it posted on my forum
http://bunpai.com/viewforum.php?id=5

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: PunBB News

Good work alex. One problem. On the navigation menu. You don't see Forums.

[img]http://img90.imageshack.us/img90/746/scripter8ko.png[/img]
http://openwings.co.cc

15 (edited by Mr Puto 2006-05-26 02:44)

Re: PunBB News

Thats because you have to add it to: lang/YOURLANGUAGE/common.php

16

Re: PunBB News

Mr Puto wrote:

Thats because you have to add it to: lang/YOURLANGUAGE/common.php

hhmm...mind explaining that one just a bit more for php impaired? wink

17 (edited by Kato 2006-06-17 00:49)

Re: PunBB News

Ugh...I uploaded the header.php on accident before I saved the original header.php...

How can I restore my original header.php so it will display my board description properly again?

hhmm...frustrating to say the least. Specially since I have already modded the header.php once or twice.

Anyone have any ideas?

18

Re: PunBB News

ummmmm go to where you downloaded punbb copy that header.php over to ur ftp!

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

19

Re: PunBB News

Will that work?  I wasn't sure...I will need to make two changes to it for my mods...but I'll try that after I get my boys to bed.  Thanks...I'll let you know if it worked.

20

Re: PunBB News

yea that will work.. and then redo ya mods..

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

21

Re: PunBB News

Thanks...worked like a charm.

22

Re: PunBB News

welcome!

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

23

Re: PunBB News

So are there any guides or helpful things someone could point me too if I wanted to add more boxes?  I've looked at some of the other miniportal systems and I like them, but they have more options for more boxes and content/information to display on the portal page. I really like how easy this one is to setup and get going...but I wish there were more options or something to code in.

24 (edited by elbekko 2006-06-17 14:58)

Re: PunBB News

Making a new box is easy:

<div class="box">
<h2><!--Title--></h2>
<div class="inbox">
<!--Content goes here-->
</div>
</div>

smile

25

Re: PunBB News

Kato wrote:
Mr Puto wrote:

Thats because you have to add it to: lang/YOURLANGUAGE/common.php

hhmm...mind explaining that one just a bit more for php impaired? wink

NM.  dumb question smile