1

(1 replies, posted in PunBB 1.2 show off)

Its for my world of warcraft guild Stureplan. http://stureplan.mine.nu been having it up for allmost half a year soon.

Well the topic is pretty clear how do I do it? Where in the css file does it specifie that borders with xx width/height is placed around it.. Take a look at my site http://stureplan.mine.nu to see what i mean (look at header picture).

Okey what shell i do here I have understood so far that i will have to do something like this.

Here is website: http://stureplan.mine.nu (wow guild site)

1. Change main.tpl and add a block to the left side.

2. In that block add somewhat of code that tells another script in like header.php or something to fetch something in functions.php (in functions.php i place the php code that is necesarry).

3. How do I do this not so good at programming php but i still get the buildup of it ^^^

Well i have enabled debug mode but it doesnt matter cuz i cant even see the site. I only get "Parse error: parse error, unexpected T_STRING in /hsphere/local/home/huset/hus1.se/news.php on line 62"

line 62 consists of

$result = $db->query('SELECT MIN(posted) FROM '.$db->prefix.'topics WHERE forum_id IN('.$forum_id.') or error('Unable to fetch earliest topic', __FILE__, __LINE__, $db->error());

where

forum_id IN('.$forum_id.')

is one of those that i changed.

Id did as you wrote but i only get this when i try to load it.. "
An error was encountered
Error: Unable to fetch topic list.
" what shell i do? I did ofc change "$forum_id = '2,4,10';" to the right forums numbers but it still cant fetch it. sad

Okey here is the code:

<?php
include('new.php');
// The forum from which we'll pull the news bits
$forum_id = 2;

// Number of news posts to include in the index
$num_posts_index = 5;

// Path to news item template
$template_path = PUN_ROOT.'plugins/AP_News_Generator/news.tpl';

// Directories in which plugin will save generated markup (must end with slash)
$output = '';
$output_dir_archive = PUN_ROOT.'plugins/AP_News_Generator/archive/';



    if (!isset($archive))
    {
    // Generate front page news
    $result = $db->query('SELECT id, subject FROM '.$db->prefix.'topics WHERE forum_id='.$forum_id.' ORDER BY sticky DESC, posted DESC LIMIT 0, '.$num_posts_index) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
    if (!$db->num_rows($result))
        message('There are no topics to generate news based on in forum with ID = '.$forum_id.'.');

    

    $news_tpl = file_get_contents($template_path) or error('Unable to open new item template '.$template_path.'. Make sure $template_path is correct', __FILE__, __LINE__);

/*    $fh = @fopen($output_dir_latest.'news.html', 'wb');
    if (!$fh)
        error('Unable to write news to '.$output_dir_latest.'news.html. Please make sure PHP has write access to the directory '.$output_dir_latest, __FILE__, __LINE__);
*/
    while ($cur_topic = $db->fetch_assoc($result))
    {
        $result2 = $db->query('SELECT posted, poster, message, hide_smilies FROM '.$db->prefix.'posts WHERE topic_id='.$cur_topic['id'].' ORDER BY posted ASC LIMIT 1') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
        $cur_post = $db->fetch_assoc($result2);
        $num_comments = $db->result($db->query('SELECT COUNT(id)-1 AS num FROM '.$db->prefix.'posts WHERE topic_id='.$cur_topic['id']));
        
        $search = array('<news_subject>', '<news_posted>', '<news_poster>', '<news_message>', '<news_comments>');
        $replace = array(pun_htmlspecialchars($cur_topic['subject']), date('Y-m-d H:i', $cur_post['posted']), pun_htmlspecialchars($cur_post['poster']), parse_message($cur_post['message'], $cur_post['hide_smilies']), '<a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_topic['id'].'">Kommentarer ('.$num_comments.')</a>');

        $output .=  str_replace($search, $replace, $news_tpl);
    }
    
    $output .= '';
    
    //display news
    echo $output;
    
}    
 else 
    {    
// Generate monthly archives
    $year_end = intval(date('Y'));
    $month_end = intval(date('n'));

    $year_start = ($month_end != 1) ? $year_end : $year_end-1;
    $month_start = ($month_end != 1) ? $month_end-1 : 12;

    // How far back should we go?
    $result = $db->query('SELECT MIN(posted) FROM '.$db->prefix.'topics WHERE forum_id='.$forum_id.'') or error('Unable to fetch earliest topic', __FILE__, __LINE__, $db->error());
    $history_limit = $db->result($result);

    $year_limit = intval(date('Y', $history_limit));
    $month_limit = intval(date('n', $history_limit));

    while ($year_end > $year_limit || $month_end > $month_limit)
    {
        $result = $db->query('SELECT id, subject FROM '.$db->prefix.'topics WHERE forum_id='.$forum_id.' AND posted>=UNIX_TIMESTAMP(\''.$year_start.'-'.$month_start.'-01\') AND posted<UNIX_TIMESTAMP(\''.$year_end.'-'.$month_end.'-01\') ORDER BY posted DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
        if ($db->num_rows($result))
        {
            $news_tpl = file_get_contents($template_path) or error('Unable to open new item template '.$template_path.'. Make sure $template_path is correct', __FILE__, __LINE__);

            $fh = @fopen($output_dir_archive.$year_end.'-'.($month_start > 9 ? $month_start : '0'.$month_start).'.html', 'wb');
            if (!$fh)
                error('Unable to write news archive to '.$output_dir_archive.$year_end.'-'.($month_end > 9 ? $month_end : '0'.$month_end).'.html Please make sure PHP has write access to the directory '.$output_dir_archive, __FILE__, __LINE__);

            while ($cur_topic = $db->fetch_assoc($result))
            {
                $result2 = $db->query('SELECT posted, poster, message, hide_smilies FROM '.$db->prefix.'posts WHERE topic_id='.$cur_topic['id'].' ORDER BY posted ASC LIMIT 1') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
                $cur_post = $db->fetch_assoc($result2);
                $num_comments = $db->result($db->query('SELECT COUNT(id)-1 AS num FROM '.$db->prefix.'posts WHERE topic_id='.$cur_topic['id']));
                
                $search = array('<news_subject>', '<news_posted>', '<news_poster>', '<news_message>', '<news_comments>');
                $replace = array(pun_htmlspecialchars($cur_topic['subject']), date('Y-m-d H:i', $cur_post['posted']), pun_htmlspecialchars($cur_post['poster']), parse_message($cur_post['message'], $cur_post['hide_smilies']), '<a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_topic['id'].'">Kommentarer ('.$num_comments.')</a>');

                fwrite($fh, str_replace($search, $replace, $news_tpl));
            }

            fclose($fh);
        }

        $year_end = $year_start;
        $month_end = $month_start;
        $year_start = ($month_end != 1) ? $year_end : $year_end-1;
        $month_start = ($month_end != 1) ? $month_end-1 : 12;
    }

//Archive display
        

    $dir = "./archive/";
if (is_dir($dir)) {
    if ($dh = opendir($dir)) {
       $file_arr = array(); $f = 0;
       
        while (false !== ($file = readdir($dh))) {
            if ($file != "." && $file != ".." && $file != "index.php" && $file[0] != ".") {
                 $file_arr[$f++] = $file;
             }
        }
        closedir($dh);
    }
      sort( $file_arr ); reset( $file_arr );
    for( $i=1; $i < count( $file_arr ) +1 ; $i++ ) {
        echo "<a href=\"'.PUN_ROOT.'news.php?month='.$i.'&archive=true\">".str_replace('.html', '', $file_arr[$i-1])."</a><br>";    
         }
        
}

    if(isset($_GET['month']) && (file_exists('./archive/'.$year_end.'-0'.$month.'.html') || file_exists('./archive/'.$year_end.'-0'.$month.'.html') ) )
    {
        if($month < 10)        
        include './archive/'.$year_end.'-0'.$month.'.html';
        else 
        include './archive/'.$year_end.'-'.$month.'.html';
    }
    else if(isset($_GET['month']) && (!file_exists('./archive/'.$year_end.'-0'.$month.'.html') || !file_exists('./archive/'.$year_end.'-0'.$month.'.html') ) )
    message($lang_common['Bad request']);
    
}


?>

Where can i change so it fetches news from multiple forums?? wink

Well the reason why iam using the ftp method is that surftown dont have the extension=php_gd2.dll activated.. and the ftp settings iam using should work cuz when i loggon with em with another ftp browser it works like a charm and the permissions is also put to 0777 on the directories so i dont get it why doesnt it work and why does 2_thumbs_1130520092.jpg pop up after a while in the directory i mean this is so fucking weird big_smile btw iam doing this as a project for a youthcenter in stockholm and they are really wanting this to work as fast as it can so would appreciate all help i can get removing this problem. I host a website from my house too but here i have extension=php_gd2.dll and it works real fine.. tongue Shame i dont have like a 100/100 mbit line that way i would be able to host the ftp from here but i only have a shitty 8/1 line so impossible to host something big... tongue

Hmm i have a very weird problem it says like this:

Warning: ftp_put(): hus1.se/gallery/2_1130520092.jpg: Permission denied in /hsphere/local/home/huset/hus1.se/gallery_post.php on line 287

Warning: ftp_put(): hus1.se/gallery/2_thumbs_1130520092.jpg: Permission denied in /hsphere/local/home/huset/hus1.se/gallery_post.php on line 288

but i dont get it cuz i have done chmod on the directories and the weirdest thing is that after a while 2_thumbs_1130520092.jpg pops up in the directory but cannot be shown by the gallery... very weird I must say tongue anyone who got a clue?

Okey but it would be awesome if you could show me what to edit in mod_active_topics.php I can paste the code maybe it isnt that hard?

<?php

$ak_limit = 4; // change this to the number of active topics you want to display.

$result = $db->query('
    SELECT t.* 
    FROM '.$db->prefix.'topics AS t 
    INNER JOIN '.$db->prefix.'forums AS f 
    ON f.id=t.forum_id 
    LEFT JOIN '.$db->prefix.'forum_perms AS fp 
    ON (
        fp.forum_id=f.id 
        AND fp.group_id='.$pun_user['g_id'].'
    ) 
    WHERE (
        fp.read_forum IS NULL 
        OR fp.read_forum=1
    ) 
    ORDER BY t.last_post DESC
    LIMIT '.$ak_limit
) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());

require PUN_ROOT.'lang/'.$pun_user['language'].'/forum.php';

?>
<div id="vf" class="blocktable">
        <div class="box">
        <div class="inbox">
            <table cellspacing="0">
            <thead>
                <tr>
                    <th class="tcl" scope="col"><?php echo $lang_common['::. Active posts'] ?></th>
                    <th class="tc2" scope="col"><?php echo $lang_common['Replies'] ?></th>
                    <th class="tc3" scope="col"><?php echo $lang_forum['Views'] ?></th>
                    <th class="tcr" scope="col"><?php echo $lang_common['Last post'] ?></th>
                </tr>
            </thead>
            <tbody>
<?php
// If there are topics in this forum.
if ($db->num_rows($result))
{
    while ($cur_topic = $db->fetch_assoc($result))
    {
        $icon_text = $lang_common['Normal icon'];
        $item_status = '';
        $icon_type = 'icon';

        if ($cur_topic['moved_to'] == null)
            $last_post = '<a href="viewtopic.php?pid='.$cur_topic['last_post_id'].'#p'.$cur_topic['last_post_id'].'">'.format_time($cur_topic['last_post']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['last_poster']).'</span>';
        else
            $last_post = ' ';

        if ($pun_config['o_censoring'] == '1')
            $cur_topic['subject'] = censor_words($cur_topic['subject']);

        if ($cur_topic['moved_to'] != 0)
            $subject = $lang_forum['Moved'].': <a href="viewtopic.php?id='.$cur_topic['moved_to'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).'</span>';
        else if ($cur_topic['closed'] == '0')
            $subject = '<a href="viewtopic.php?id='.$cur_topic['id'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).'</span>';
        else
        {
            $subject = '<a href="viewtopic.php?id='.$cur_topic['id'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).'</span>';
            $icon_text = $lang_common['Closed icon'];
            $item_status = 'iclosed';
        }

        if (!$pun_user['is_guest'] && $cur_topic['last_post'] > $pun_user['last_visit'] && $cur_topic['moved_to'] == null)
        {
            $icon_text .= ' '.$lang_common['New icon'];
            $item_status .= ' inew';
            $icon_type = 'icon inew';
            $subject = '<strong>'.$subject.'</strong>';
            $subject_new_posts = '<span class="newtext">[ <a href="viewtopic.php?id='.$cur_topic['id'].'&action=new" title="'.$lang_common['New posts info'].'">'.$lang_common['New posts'].'</a> ]</span>';
        }
        else
            $subject_new_posts = null;

        // Should we display the dot or not? :)
        if (1 == 0 && !$pun_user['is_guest'] && $pun_config['o_show_dot'] == '1')
        {
            if ($cur_topic['has_posted'] == $pun_user['id'])
                $subject = '<strong>·</strong> '.$subject;
            else
                $subject = '  '.$subject;
        }

        if ($cur_topic['sticky'] == '1')
        {
            $subject = '<span class="stickytext">'.$lang_forum['Sticky'].': </span>'.$subject;
            $item_status .= ' isticky';
            $icon_text .= ' '.$lang_forum['Sticky'];
        }

        $num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $pun_user['disp_posts']);

        if ($num_pages_topic > 1)
            $subject_multipage = '[ '.paginate($num_pages_topic, -1, 'viewtopic.php?id='.$cur_topic['id']).' ]';
        else
            $subject_multipage = null;

        // Should we show the "New posts" and/or the multipage links?
        if (!empty($subject_new_posts) || !empty($subject_multipage))
        {
            $subject .= '  '.(!empty($subject_new_posts) ? $subject_new_posts : '');
            $subject .= !empty($subject_multipage) ? ' '.$subject_multipage : '';
        }

?>
                <tr<?php if ($item_status != '') echo ' class="'.trim($item_status).'"'; ?>>
                    <td class="tcl">
                        <div class="intd">
                            <div class="<?php echo $icon_type ?>"><div class="nosize"><?php echo trim($icon_text) ?></div></div>
                            <div class="tclcon">
                                <?php echo $subject."\n" ?>
                            </div>
                        </div>
                    </td>
                    <td class="tc2"><?php echo ($cur_topic['moved_to'] == null) ? $cur_topic['num_replies'] : ' ' ?></td>
                    <td class="tc3"><?php echo ($cur_topic['moved_to'] == null) ? $cur_topic['num_views'] : ' ' ?></td>
                    <td class="tcr"><?php echo $last_post ?></td>
                </tr>
<?php

    }
}
else
{

?>
                <tr>
                    <td class="tcl" colspan="4"><?php echo $lang_forum['Empty forum'] ?></td>
                </tr>
<?php

}

?>
            </tbody>
            </table>
        </div>
    </div>
</div>

I use mod_active_topics.php to show the 4 latests posts on me frontpage of my site. What should i edit in it so it dont redirect me to viewtopic instead of showing me viewpoll..? Right now I can see the polls if i enter via the forum but if i go via mod_active_topics.php it only shows the post without the poll. Be gentle with me cuz iam new at this wink Here is the site if u wanna have a look: http://stureplan.mine.nu/punbb

Got it working now, the only problem I have now is that Easy poll wont show the polls when u press it from a link from alex kings mod that shows news in a news section of the site anyone who got a clue? smile

Thx mate alot of good shit in that link u gave me!  smile

Hmm i have the same problem it justs changes the footer.php back. Kinda weird, what can write to footer?

EDIT: FINALLY GOT IT WORKING WOHO! wink

Hmm thought i checked that.. might not have done it since its there wink iam abit tired been editing these files all day long wink Those active posts thingys is from another post here on the forum. I can paste the code i used.

This is from a file i created and is loaded from the index.php

<?php

$ak_limit = 3; // change this to the number of active topics you want to display.

$result = $db->query('
    SELECT t.* 
    FROM '.$db->prefix.'topics AS t 
    INNER JOIN '.$db->prefix.'forums AS f 
    ON f.id=t.forum_id 
    LEFT JOIN '.$db->prefix.'forum_perms AS fp 
    ON (
        fp.forum_id=f.id 
        AND fp.group_id='.$pun_user['g_id'].'
    ) 
    WHERE (
        fp.read_forum IS NULL 
        OR fp.read_forum=1
    ) 
    ORDER BY t.last_post DESC
    LIMIT '.$ak_limit
) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());

require PUN_ROOT.'lang/'.$pun_user['language'].'/forum.php';

?>
<div id="vf" class="blocktable">
        <div class="box">
        <div class="inbox">
            <table cellspacing="0">
            <thead>
                <tr>
                    <th class="tcl" scope="col"><?php echo $lang_common['Active posts'] ?></th>
                    <th class="tc2" scope="col"><?php echo $lang_common['Replies'] ?></th>
                    <th class="tc3" scope="col"><?php echo $lang_forum['Views'] ?></th>
                    <th class="tcr" scope="col"><?php echo $lang_common['Last post'] ?></th>
                </tr>
            </thead>
            <tbody>
<?php
// If there are topics in this forum.
if ($db->num_rows($result))
{
    while ($cur_topic = $db->fetch_assoc($result))
    {
        $icon_text = $lang_common['Normal icon'];
        $item_status = '';
        $icon_type = 'icon';

        if ($cur_topic['moved_to'] == null)
            $last_post = '<a href="viewtopic.php?pid='.$cur_topic['last_post_id'].'#p'.$cur_topic['last_post_id'].'">'.format_time($cur_topic['last_post']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['last_poster']).'</span>';
        else
            $last_post = ' ';

        if ($pun_config['o_censoring'] == '1')
            $cur_topic['subject'] = censor_words($cur_topic['subject']);

        if ($cur_topic['moved_to'] != 0)
            $subject = $lang_forum['Moved'].': <a href="viewtopic.php?id='.$cur_topic['moved_to'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).'</span>';
        else if ($cur_topic['closed'] == '0')
            $subject = '<a href="viewtopic.php?id='.$cur_topic['id'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).'</span>';
        else
        {
            $subject = '<a href="viewtopic.php?id='.$cur_topic['id'].'">'.pun_htmlspecialchars($cur_topic['subject']).'</a> <span class="byuser">'.$lang_common['by'].' '.pun_htmlspecialchars($cur_topic['poster']).'</span>';
            $icon_text = $lang_common['Closed icon'];
            $item_status = 'iclosed';
        }

        if (!$pun_user['is_guest'] && $cur_topic['last_post'] > $pun_user['last_visit'] && $cur_topic['moved_to'] == null)
        {
            $icon_text .= ' '.$lang_common['New icon'];
            $item_status .= ' inew';
            $icon_type = 'icon inew';
            $subject = '<strong>'.$subject.'</strong>';
            $subject_new_posts = '<span class="newtext">[ <a href="viewtopic.php?id='.$cur_topic['id'].'&action=new" title="'.$lang_common['New posts info'].'">'.$lang_common['New posts'].'</a> ]</span>';
        }
        else
            $subject_new_posts = null;

        // Should we display the dot or not? :)
        if (1 == 0 && !$pun_user['is_guest'] && $pun_config['o_show_dot'] == '1')
        {
            if ($cur_topic['has_posted'] == $pun_user['id'])
                $subject = '<strong>·</strong> '.$subject;
            else
                $subject = '  '.$subject;
        }

        if ($cur_topic['sticky'] == '1')
        {
            $subject = '<span class="stickytext">'.$lang_forum['Sticky'].': </span>'.$subject;
            $item_status .= ' isticky';
            $icon_text .= ' '.$lang_forum['Sticky'];
        }

        $num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $pun_user['disp_posts']);

        if ($num_pages_topic > 1)
            $subject_multipage = '[ '.paginate($num_pages_topic, -1, 'viewtopic.php?id='.$cur_topic['id']).' ]';
        else
            $subject_multipage = null;

        // Should we show the "New posts" and/or the multipage links?
        if (!empty($subject_new_posts) || !empty($subject_multipage))
        {
            $subject .= '  '.(!empty($subject_new_posts) ? $subject_new_posts : '');
            $subject .= !empty($subject_multipage) ? ' '.$subject_multipage : '';
        }

?>
                <tr<?php if ($item_status != '') echo ' class="'.trim($item_status).'"'; ?>>
                    <td class="tcl">
                        <div class="intd">
                            <div class="<?php echo $icon_type ?>"><div class="nosize"><?php echo trim($icon_text) ?></div></div>
                            <div class="tclcon">
                                <?php echo $subject."\n" ?>
                            </div>
                        </div>
                    </td>
                    <td class="tc2"><?php echo ($cur_topic['moved_to'] == null) ? $cur_topic['num_replies'] : ' ' ?></td>
                    <td class="tc3"><?php echo ($cur_topic['moved_to'] == null) ? $cur_topic['num_views'] : ' ' ?></td>
                    <td class="tcr"><?php echo $last_post ?></td>
                </tr>
<?php

    }
}
else
{

?>
                <tr>
                    <td class="tcl" colspan="4"><?php echo $lang_forum['Empty forum'] ?></td>
                </tr>
<?php

}

?>
            </tbody>
            </table>
        </div>
    </div>
</div>

EDIT: Crap i just checked the footer.php and i cant find that "<<"... hmm what is being loaded before the footer..

?><div id="brdfooter" class="block">
    <h2><span><?php echo $lang_common['Board footer'] ?></span></h2>
    <div class="box">
        <div class="inbox">
<?php

I have been adding alot of mods to my punbb site now and suddenly a "<" have appeared down in the left corner! I have checked the code i have been editing and i cant find where i have double typed "<<" soon iam going insane ;D

You can check it out at http://stureplan.mine.nu/punbb

Hey!

Iam pretty new on the punbb front allways been using phpbb forums before. Iam now converting my website to punbb.

If you check out the look on my old site http://stureplan.mine.nu you can see that iam using phpbbfetchall to fetch news from a certain forum to show them on the mainpage.

If you check out my punbb site http://stureplan.mine.nu/punbb you can see that iam also using that news mod that allows to fetch news just as phpbbfetchall does.. If u look over the news topics u can see that i have made 4 "boxes" that i wanna fill with what i have written in them like people online etc.. How do i fetch this from the database? like on my phpbb site i have it fetch latest poll, latest 5 posts and shit like that. Well I have alot of questions hope someone wanna answer them wink

And I must say i used the converter from the phpbb forum and it kicks ass thx to the dude that made that smile