I didn't test it, but I'm almost certain this should work. 

find:

$news_forum_id = 5;

add after:

$news_forum_id2 =6;

find this line:

$result = $db->query('select id, subject, num_replies, posted from '.$db->prefix.'topics WHERE forum_id='.$news_forum_id.' ORDER BY -posted LIMIT '.$limit.';')or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());

Replace with:

$result = $db->query('select id, subject, num_replies, posted from '.$db->prefix.'topics WHERE forum_id='.$news_forum_id.' OR forum_id='.$news_forum_id2.' ORDER BY -posted LIMIT '.$limit.';')or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());

All this will load news from 2 forums.  If you need more, just make similar changes in the WHERE clause. For example if you want to limit to 4 forums do something along the lines of:

WHERE forum_id='.$news_forum_id.' OR forum_id='.$news_forum_id2.' OR forum_id='.$news_forum_id3.' OR forum_id='.$news_forum_id4.'

for the WHERE clause.  Also define the variables for each of the $news_forum_id*
-------------------

Alternately if you want to load from all forums, just don't specify the WHERE clause which currently limits the SQL query to specific forum_ids.

Query for getting all forums:

$result = $db->query('select id, subject, num_replies, posted from '.$db->prefix.'topics ORDER BY -posted LIMIT '.$limit.';')or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());

Hope this helps

I edited the code in my first post to add the author.

You're welcome. smile

Punbb News Script - by Jesse Spillane (http://www.jessespillane.com)

edits:
March 8th  Fixed the comment link.  Sorry if this caused any trouble.
March 13th Now shows poster name below post title.

Motivation

My motivation was to create a news or blog system which takes the the latest topics in a specified forum and uses them as news entries on my site.  For example, I have a forum which the permissions are set so only administrators can post topics.   Each of these topics are treated as news entries. I wanted my index page to display the latest X posts in the news forum.  I didn't want to use the admin news generator plugin as I wanted this system to be dynamic.  I also didn't want to sort through bloated portal system mods and rip them apart to get a few features I wanted.

I searched for about an hour for a script which did this, but I eventually gave up and decided to write one myself.  I figure someone may get some use out of it.

Instructions

The script is very simple to use.  This file will output the html for the news.  Below is a description of the variables which you should set:

$news_forum_id - Set this to the forum which contains your news
$limit - This is the number news entries to display
$forum_path - Set this to the path of your punbb install.

<?php

/**
Punbb News Script
Written by: Jesse Spillane (http://www.jessespillane.com)
*/

$news_forum_id = 5;
$limit = 5;
$forum_path = './forum/';

define('PUN_ROOT', $forum_path);
require PUN_ROOT.'include/common.php';

define('PUN_TURN_OFF_MAINT', 1);
define('PUN_QUIET_VISIT', 1);

require PUN_ROOT.'include/parser.php';

echo "<h2>News</h2>";

$result = $db->query('select id, subject, num_replies, posted from '.$db->prefix.'topics WHERE forum_id='.$news_forum_id.' ORDER BY -posted LIMIT '.$limit.';')or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
while ($row = $db->fetch_assoc($result))
{
    $id = $row['id'];
    $subject = $row['subject'];
    $num_replies = $row['num_replies'];
    $posted = date("F j, Y, g:i a", $row['posted']);

    $result2 = $db->query('select message, poster from '.$db->prefix.'posts WHERE topic_id='.$id.' ORDER BY id LIMIT 1 ')or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
    
    $post = $db->fetch_assoc($result2);
    $message = parse_message($post['message'], 1);
    $poster = $post['poster'];

?>


<div style='margin-bottom: 30px;'>    
  <h3>
    <?php echo $subject; ?>
  </h3> 

  <hr />

  <div>
    <i> by <?php echo $poster; ?> </i>
  </div>

  <div>
    <i> <?php echo $posted; ?> </i>
  </div>

  <div>
    <?php echo $message; ?>
  </div>

  <div style='float: right;'>
    <?php
      echo '<a href='.$forum_path.'viewtopic.php?id='.$id.'>Comments ('.$num_replies.')</a>';
    ?>      
  </div>

</div>
<br />

<?php
  

}

?>

Sorry if this has been done.  It is quite simple.

Well, I think I'll stick with 1.1.5 for now, since it has everything I need.

6

(99 replies, posted in General discussion)

I'm going to have to disagree with the system of choice for audio statement.  Windows and Macs both are equally as capable for working with audio and have software which is very professional on both sides.  However, many tend to stick to Pro Tools, not because it is any better than another software, but because it has a name.

Once upon a time, you could probably make such a statement that Macs were better for audio, but that was in the days when Pcs were tweaked to work in the office.  I prefer windows based recording software such as Sonar.

I have a copy of 1.1.5.  Should I upgrade to 1.2 beta?  I haven't installed the board yet.  When punbb goes to a final release would the conversion be a simple overwriting of files?

8

(99 replies, posted in General discussion)

I have trouble liking Macs, but I know I haven't worked with them enough to make any good judgements on them.  I took a summer camp a few years ago for learning how to record music.  They used a Mac based system.  I just couldn't get over how buggy Cubase is on that system.  I could have listed 30 things that were wrong with that program. But I shouldn't judge the system by one software.  Macs sound really good after having your computer spontainiously crash every two seconds.

I was going to integrate my site with the punbb forum by drawing information from the posts from the database.  I would guess that the messages in the database are stored as text and bbcode.  When looking at the parser.php, it has a function called parse_message() which seems to look at the options and displays parsed text.  Would it work if I did a simple mysql query and then used that function to translate the bbcode to an html output so the site can print pretty looking text?  Any help is appriciated.

Edit:  To add to this, how can I work with cookies or sessions so that the user is recognized when they visit the site rather than the forum?

I hope I posted this in the right section.  Maybe this should have gone in the mod discussion board?  BTW, I love the board software!

10

(1 replies, posted in Test forum)

Testing to see if a highlighter for gamemaker code works with punbb
Score!!
/*
draw_gethexcolor
Script by Sensei Eggwoah
--Gets the hexidecimal color
value of the point on the screen at
the point x,y (argument0,argument1)

For example: draw_gethexcolor(mouse_x,mouse_y) returns
the hexidecimal color value at the position of the mouse.
*/

cvar=0;
color=draw_getpixel(argument0,argument1);

red_number=color_get_red(color);
green_number=color_get_green(color);
blue_number=color_get_blue(color);

red1=floor(red_number/16);
red2=red_number-(red1*16);

green1=floor(green_number/16);
green2=green_number-(green1*16);

blue1=floor(blue_number/16);
blue2=blue_number-(blue1*16);

for (i=0; i<6; i+=1;)
{
        switch (i)
        {
                case 0: cvar[0]=red1; break;
                case 1: cvar[1]=red2; break;
                case 2: cvar[2]=green1; break;
                case 3: cvar[3]=green2; break;
                case 4: cvar[4]=blue1; break;
                case 5: cvar[5]=blue2; break;
        }
        switch (cvar[i])
        {
                case 0: cvar[i]="0";break;
                case 1: cvar[i]="1";break;
                case 2: cvar[i]="2";break;
                case 3: cvar[i]="3";break;
                case 4: cvar[i]="4";break;
                case 5: cvar[i]="5";break;
                case 6: cvar[i]="6";break;
                case 7: cvar[i]="7";break;
                case 8: cvar[i]="8";break;
                case 9: cvar[i]="9";break;
                case 10: cvar[i]="A";break;
                case 11: cvar[i]="B";break;
                case 12: cvar[i]="C";break;
                case 13: cvar[i]="D";break;
                case 14: cvar[i]="E";break;
                case 15: cvar[i]="F";break;
        }
}
return string(cvar[0])+string(cvar[1])+string(cvar[2])+string(cvar[3])+string(cvar[4])+string(cvar[5]);

11

(5 replies, posted in PunBB 1.2 discussion)

Thank you for the help.  Ill try it out. 

edit:  It all worked fine, except that the images that are displayed when there is a new topic in a forum dont show up

12

(5 replies, posted in PunBB 1.2 discussion)

I just uploaded the forum to my website and I love it, but I was wondering if I could bump the font size of all the text up a couple points.  I would like it better that way.  Is there an easy way of doing this?

Edit:  Oh yeah some other questions.  Is it possible to pin topics and edit topic names after posting?