1 (edited by Judge 2006-09-08 07:19)

Topic: Nyheter

Hejsan!!!

jag kör med wiki portal för punbb och har en liten fråga.

när man skriver in en nyhet i forumet som sen visas på första (index) sidan som nyheter. så kommer det bara me 2 rader fast man skrivit en jädra massa. hur kommer det sig. och hur ändrar man det. nån som vet?

jag tror att det är nått i index.php men är inte säker smile

såhär ser min ut

<?php

define('PUN_ROOT', './');
define('PUN_QUIET_VISIT', 1);
require PUN_ROOT.'include/common.php';

$page_title = pun_htmlspecialchars($pun_config['o_board_title']);
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';
require PUN_ROOT.'include/parser.php';

function pun_news($fid='', $show=15, $truncate=1)
{
    global $lang_common, $db, $pun_config, $db_prefix;
    $max_subject_length = 30;
    $show_max_topics = 50;
    $fid = intval($fid);
    $order_by = 't.posted';
    $forum_sql = '';
    // Was a forum ID supplied?
    if ( $fid ) $forum_sql = 'f.id='.$fid.' AND ';
    $show = intval($show);
    if ($show < 1 || $show > $show_max_topics)
    $show = 15;
    $saveddate="";
    // Fetch $show topics
    $result = $db->query('SELECT t.id, t.poster, t.subject, t.posted, t.last_post, t.num_replies, f.id AS fid, f.forum_name FROM '.$db_prefix.'topics AS t INNER JOIN '.$db_prefix.'forums AS f ON t.forum_id=f.id WHERE f.id='.$fid.' AND t.moved_to IS NULL ORDER BY '.$order_by.' DESC') or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
    $show_count = 0;
    if ( !$db->num_rows($result) ) return $output;
    while ( ($show_count < $show) && ($cur_topic = $db->fetch_assoc($result)) ) {
        $temp = '';
        if ($pun_config['o_censoring'] == '1')
            $cur_topic['subject'] = censor_words($cur_topic['subject']);
        if (pun_strlen($cur_topic['subject']) > $max_subject_length)
            $subject_truncated = trim(substr($cur_topic['subject'], 0, ($max_subject_length-5))).' ...';
        else
            $subject_truncated = $cur_topic['subject'];

        $newsheading = '<a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_topic['id'].'">'.pun_htmlspecialchars($subject_truncated).'</a>';
        $newsfooter = 'Skrivet av: '.$cur_topic['poster'].' | '.format_time($cur_topic['posted']).' | <a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_topic['id'].'&action=new">kommentarer ('.$cur_topic['num_replies'].')</a>';

        // Group posts by date
        $thisdate = date('l, d F Y', $cur_topic['posted']);
        if ($saveddate)
        {
            $temp .= "</div></div>";
        }
        $temp .= '<div class="block"><h2><span>'.$newsheading.'</span></h2><div class="box"><div class="inbox">';
        $saveddate = $thisdate;
        $id = $cur_topic['id'];
        $msg = $db->query('SELECT id, poster, poster_id, poster_ip, poster_email, message, posted, edited, edited_by FROM '.$db_prefix.'posts WHERE topic_id='.$id.' LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
            if ( !$db->num_rows($msg) ) continue;
        $cur_post = $db->fetch_assoc($msg);
        // Display first paragraph only (comment out next four lines to turn off)
        //if ($truncate == 1)
        //{
        $paragraph = preg_split("/\s*\n+/", $cur_post['message']);
            if (isset($paragraph[1])) {
                $cur_post['message'] = $paragraph[0] . "...";
            }
        //}
        $cur_post['message'] = parse_message($cur_post['message'], 0);
        // Display 80 karakter only (comment out next 8 lines to turn off)
        while ($cur_posts = $db->fetch_assoc($msg))
        {
            if (pun_strlen($cur_posts['message']) >= 80)
            {
                $cur_posts['message'] = substr($cur_posts['message'], 0, 79);
                $cur_posts['message'] .= '…';
            }
        }
        $temp .= '<div class="box" style="padding:5px; margin:2px;">'.$cur_post['message']."</div>";
        $temp .= '<p>'.$newsfooter.'</p>';
        $temp .= "</div>";
        if (isset($output)) {
            $output .= $temp;
        }
        else {
            $output = $temp;
        }
        ++$show_count;
    } // end of while
    $output .= "</div></div>";
    return $output;
}
?>
        <div class="block">
            <h2><span>Information</span></h2>
            <div class="box">
                <div class="inbox">
                                  </p>
             </p>
<p>Välkomna till bla bla bla bla =)
<br>
<br>
                   </p>
                </div>
            </div>
        </div>
<?php
echo pun_news(1, 5, 0);

require PUN_ROOT.'footer.php';