1 (edited by Tubby 2006-12-21 06:49)

Topic: Progress

Well, i havent had much time if not any time at all to put forth all of my time and effort to develope punportal 2.0 yet, but i have made some progress by beginning on the main portal content such as the news, welcoming ect ect. Nothin much really.

Here is the source code so far:

<?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';
 
?>
<div class="block">
<h2><span><?php echo 'Welcome to '.$pun_config['o_board_title'].''; ?></span></h2>
        <div class="box">
            <div class="inbox">
            <div><?php echo $pun_config['o_portal_welcome_message'] ?></div>
        </div>
    </div>
</div>
<?
$fid = $pun_config['o_news_id'];
$newslimit = $pun_config['o_news_limit'];

 $result = $db->query('SELECT t.id, t.subject, t.num_replies, t.num_views, t.forum_id, p.topic_id, p.poster, p.poster_id, p.message, p.hide_smilies, p.posted, f.forum_name, u.use_avatar FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id AND p.posted=t.posted INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id WHERE t.forum_id='.$fid.' AND t.moved_to IS NULL AND f.redirect_url IS NULL ORDER BY t.posted DESC LIMIT '.$newslimit) or error('Unable to fetch the portal news', __FILE__, __LINE__, $db->error());
 
if ($db->num_rows($result))
{
    while($cur_news = $db->fetch_assoc($result))
    {
    $news_message = parse_message($cur_news['message'], $cur_news['hide_smilies']);
    $news_title = $cur_news['subject'];
    $news_poster = '<a href="'.$pun_config['o_base_url'].'/profile.php?id='.$cur_news['poster_id'].'">'.pun_htmlspecialchars($cur_news['poster']).'</a>';
    $views = $cur_news['num_views'];
    $replies = $cur_news['num_replies'];
    $news_date = date('Y-m-d', $cur_news['posted']);
    
    
        $max_character_length = $pun_config['o_max_characters'];
    
        if (pun_strlen($news_message) > $max_character_length && $pun_config['o_news_truncate'] == '1')
            $news_truncated = trim(substr($news_message, 0, ($max_character_length))).' ..........<br /><br /><a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_news['topic_id'].'">Read More!</a>';
        else
            $news_truncated = $news_message;
    
    
        echo '<div class="block" id="news"><h2><span>'.$news_title.'</span></h2><div class="box"><div class="inbox"><div>'.$news_truncated.'</div><div style="text-align: right">Posted by '.$news_poster.' | Date Posted: '.$news_date.'<div style="text-align: right">Views: '.$views.' | Replies: '.$replies.    '</div></div></div></div></div>';
    }
}

?>

            
<?php
require PUN_ROOT.'footer.php';

Please state your opinions and feel free to add to the code and share it with us smile i will be adding much more to it as time goes by.

On a side note i will probably end up taking all of the style="" code out and inserting code in to base.css to style the portal. I find it to be much more efficient for some reason. Oh and another thing is that my code is far from valid and iam terrible when it comes to validation due to being a messy coder tongue, so if any of you neat coders out there would like to validate this then by all means feel free to do so and share it smile will be glad to add it to the developement.