Re: New frontpage index mod!

Well, no one seems to be able to get the truncate to work. sad

77

Re: New frontpage index mod!

The truncate script that soonotes posted works perfectly if you make that slight change to the regex. It just needs adapting for your script.

78

Re: New frontpage index mod!

soonotes wrote:

Thank you MattF. Nice job, regex gives me headaches.

I should be thanking you for posting the script, not vice versa. smile Cheers.

79 (edited by bingiman 2007-06-23 18:14)

Re: New frontpage index mod!

I know that MattF. The problem is that I can't do it. I've tried along with quaker and we can't get it at all. We are not coders and we have absolutely no idea where to even begin. Can you add it to the script if I post it here for you. I would really, really appreciate it.

80 (edited by MattF 2007-06-23 18:20)

Re: New frontpage index mod!

bingiman wrote:

I know that MattF. The problem is that I can't do it. I''ve tried along with quaker and we can't get it at all.

Apologies. smile So you're actually referring to getting the script working generally within that script then, and not specifically to the truncate not working, so to speak? (If that makes any sense). big_smile big_smile

Edit: Integrating the truncate into that index script is what I was meaning by the above. big_smile I'll have an attempt at it later.

81 (edited by bingiman 2007-06-23 18:27)

Re: New frontpage index mod!

Here is the latest version of the completed script.

<?php
 
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';
 
//Set the page title here
$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';
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.'lang/'.$pun_user['language'].'/forum.php';

$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_index_message_show'] == 1)
{
?>
 
        <div class="block">
            <h2><span><?php echo pun_htmlspecialchars($pun_config['o_index_message_head']) ?></span></h2>
            <div class="box">
                <div class="inbox">
        <?php echo $pun_config['o_index_message'] ?>
                </div>
            </div>
        </div>
<?php
}
$result = $db->query('SELECT t.id, t.subject, t.num_replies, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.forum_id, u.use_avatar, 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']);
?>
    <div class="block">
       
<?php
        if ($pun_config['o_avatars'] == '1' && $cur_post['use_avatar'] == '1' && $pun_user['show_avatars'] != '0')
        {
            if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif'))
                $user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" /></a>';
            else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg'))
                $user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" /></a>';
            else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png'))
                $user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" /></a>';
        }
        else
            $user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img alt="" src="img/noimage.gif" /></a>';
    echo "\t\t\t\t\t\t\t".'<h2><strong><a href="forum.php">Forum</a> » <a href="viewforum.php?id='.$cur_post['forum_id'].'">'.pun_htmlspecialchars($cur_post['forum_name']).'</a>'.'</strong></h2>'."\n";
?>
<div class="box">
    <div class="inbox">
<ul><li>
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
    <tr>
        <td style="border: 0px; padding: 0px 10px 7px 7px;"><a class="news_subject" href="viewtopic.php?id=<?php echo $cur_post['id']; ?>"><?php echo $cur_post['subject']; ?></a></td>
    </tr>
</table> 
 
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
    <tr>
        <td align="left" style="white-space: nowrap; width: 8em; padding-left: 7px; padding-top: 6px; padding-bottom: 30px; border: 0px;" valign="top"><?php echo $user_avatar ?></td>
        <td style="text-align: left; border: 0px; padding-top: 0px;" valign="top"><?php echo $cur_post['message']."\n" ?></td>
    </tr>
</table>

<table class="news_footer" cellpadding="0" cellspacing="0" width="100%">
    <tr>
        <td width="100%">
            
            <?php
    echo "\t\t\t\t\t\t\t".'<span class="user" style="float:left">Posted: '.format_time($cur_post['posted']).' by:<span class="user'.(isset($cur_post['g_title']) ? ' '.strtolower(str_replace(' ', '', $cur_post['g_title'])) : '').'"> <a class="poster" href="profile.php?id='.$cur_post['poster_id'].'">'.pun_htmlspecialchars($cur_post['poster']).'</a> |  Views: '. $cur_post['num_views'].' |  Replies: '. $cur_post['num_replies'].'</span></span>'."\n";
        if ($cur_post['poster_id'] == $pun_user['id'] || $pun_user['g_id'] < PUN_GUEST)
    echo "\t\t\t\t\t\t\t".'<a href="viewtopic.php?id='.$cur_post['id'].'">'.pun_htmlspecialchars($lang_portal['Visit_Topic']).'</a>'.'<span style="float:right">'.'<a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a>'.' | <a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a> | <a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>'.' | <a href="post.php?tid='.$cur_post['id'].'">'.'Reply'.'</a>'.' | <a href="post.php?tid='.$cur_post['id'].'&qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a>'.'</span>'."\n\n\n\n";
?>
        </td>
    </tr>
</table>       
</li></ul>
        </div>
    </div>
</div>
<?
}
     }

require PUN_ROOT.'footer.php';

All that is missing is the truncate function along with a link to "Read More" which would take you to the rest of the post.

Thanks in advance MattF.

Re: New frontpage index mod!

Try this

<?php
 
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';
 
//Set the page title here
$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';
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.'lang/'.$pun_user['language'].'/forum.php';

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


function close_tags($string)
{
  // match opened tags
  if(preg_match_all('/<([a-z\:\-]+)[ >]/', $string, $start_tags))
  {
    $start_tags = $start_tags[1];

    // match closed tags
    if(preg_match_all('/<\/([a-z]+)>/', $string, $end_tags))
    {
      $complete_tags = array();
      $end_tags = $end_tags[1];
    
      foreach($start_tags as $key => $val)
      {   
        $posb = array_search($val, $end_tags);
        if(is_integer($posb))
        {
          unset($end_tags[$posb]);
        }
        else
        {
          $complete_tags[] = $val;
        }
      }
    }
    else
    {
      $complete_tags = $start_tags;
    }
    
    $complete_tags = array_reverse($complete_tags);
    for($i = 0; $i < count($complete_tags); $i++)
    {
      $string .= '</' . $complete_tags[$i] . '>';
    }
  }
  // Removes the </img> tag
$xhtml_tags = array("</img>", "</hr>", "</br>");
$string = str_replace($xhtml_tags, "", $string);
  return $string;
}


function truncate($str, $id) {

$len = '200'; //This is how many characters are displayed.
$splitter = '<!--MORE-->';
$append = ' ... <span class="barlink"><i><a href="viewtopic.php?pid='.$id.'#p'.$id.'">View Post';
    if(strlen($str) <= $len){
        return $str;
    }
    if($len > 0 && !strstr($str,$splitter)){
        preg_match('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){'.$len.',}\b#U', $str,$matches);
        $str = $matches[0];
        # remove trailing opener tags and close all other open tags:
        $str = close_tags(preg_replace('#\s*<[^>]+>?\s*$#','',$str).$append);
    } else {
        $arr = explode($splitter,$str,2);
        $str = $arr[0];
    }
    return $str;
}

if ($pun_config['o_index_message_show'] == 1)
{
?>
 
        <div class="block">
            <h2><span><?php echo pun_htmlspecialchars($pun_config['o_index_message_head']) ?></span></h2>
            <div class="box">
                <div class="inbox">
        <?php echo $pun_config['o_index_message'] ?>
                </div>
            </div>
        </div>
<?php
}
$result = $db->query('SELECT t.id, t.subject, t.num_replies, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.forum_id, u.use_avatar, p.id AS post_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))
                            {
$id = ($cur_post['post_id']);
                                    $pre = parse_message($cur_post['message'], $cur_post['hide_smilies']);
$str = truncate ($pre, $id);
?>
    <div class="block">
       
<?php
        if ($pun_config['o_avatars'] == '1' && $cur_post['use_avatar'] == '1' && $pun_user['show_avatars'] != '0')
        {
            if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif'))
                $user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" /></a>';
            else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg'))
                $user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" /></a>';
            else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png'))
                $user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" /></a>';
        }
        else
            $user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img alt="" src="img/noimage.gif" /></a>';
    echo "\t\t\t\t\t\t\t".'<h2><strong><a href="forum.php">Forum</a> » <a href="viewforum.php?id='.$cur_post['forum_id'].'">'.pun_htmlspecialchars($cur_post['forum_name']).'</a>'.'</strong></h2>'."\n";
?>
<div class="box">
    <div class="inbox">
<ul><li>
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
    <tr>
        <td style="border: 0px; padding: 0px 10px 7px 7px;"><a class="news_subject" href="viewtopic.php?id=<?php echo $cur_post['id']; ?>"><?php echo $cur_post['subject']; ?></a></td>
    </tr>
</table> 
 
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
    <tr>
        <td align="left" style="white-space: nowrap; width: 8em; padding-left: 7px; padding-top: 6px; padding-bottom: 30px; border: 0px;" valign="top"><?php echo $user_avatar ?></td>
        <td style="text-align: left; border: 0px; padding-top: 0px;" valign="top"><?php echo $str ?></td>
    </tr>
</table>

<table class="news_footer" cellpadding="0" cellspacing="0" width="100%">
    <tr>
        <td width="100%">
            
            <?php
    echo "\t\t\t\t\t\t\t".'<span class="user" style="float:left">Posted: '.format_time($cur_post['posted']).' by:<span class="user'.(isset($cur_post['g_title']) ? ' '.strtolower(str_replace(' ', '', $cur_post['g_title'])) : '').'"> <a class="poster" href="profile.php?id='.$cur_post['poster_id'].'">'.pun_htmlspecialchars($cur_post['poster']).'</a> |  Views: '. $cur_post['num_views'].' |  Replies: '. $cur_post['num_replies'].'</span></span>'."\n";
        if ($cur_post['poster_id'] == $pun_user['id'] || $pun_user['g_id'] < PUN_GUEST)
    echo "\t\t\t\t\t\t\t".'<a href="viewtopic.php?id='.$cur_post['id'].'">'.pun_htmlspecialchars($lang_portal['Visit_Topic']).'</a>'.'<span style="float:right">'.'<a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a>'.' | <a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a> | <a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>'.' | <a href="post.php?tid='.$cur_post['id'].'">'.'Reply'.'</a>'.' | <a href="post.php?tid='.$cur_post['id'].'&qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a>'.'</span>'."\n\n\n\n";
?>
        </td>
    </tr>
</table>       
</li></ul>
        </div>
    </div>
</div>
<?
}
     }

require PUN_ROOT.'footer.php';

83

Re: New frontpage index mod!

soonote how can i remove the ... view post im going to add a read more down by the quote etc.

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: New frontpage index mod!

Change

        $str = close_tags(preg_replace('#\s*<[^>]+>?\s*$#','',$str).$append);

to

        $str = close_tags(preg_replace('#\s*<[^>]+>?\s*$#','',$str));

Re: New frontpage index mod!

Don't mean to be a pain soonotes but is there a way for this to display more than one forum?

86

Re: New frontpage index mod!

here updated code again...hahah

<?php
 
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';
 
//Set the page title here
$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';
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.'lang/'.$pun_user['language'].'/forum.php';

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


function close_tags($string)
{
  // match opened tags
  if(preg_match_all('/<([a-z\:\-]+)[ >]/', $string, $start_tags))
  {
    $start_tags = $start_tags[1];

    // match closed tags
    if(preg_match_all('/<\/([a-z]+)>/', $string, $end_tags))
    {
      $complete_tags = array();
      $end_tags = $end_tags[1];
    
      foreach($start_tags as $key => $val)
      {   
        $posb = array_search($val, $end_tags);
        if(is_integer($posb))
        {
          unset($end_tags[$posb]);
        }
        else
        {
          $complete_tags[] = $val;
        }
      }
    }
    else
    {
      $complete_tags = $start_tags;
    }
    
    $complete_tags = array_reverse($complete_tags);
    for($i = 0; $i < count($complete_tags); $i++)
    {
      $string .= '</' . $complete_tags[$i] . '>';
    }
  }
  // Removes the </img> tag
$xhtml_tags = array("</img>", "</hr>", "</br>");
$string = str_replace($xhtml_tags, "", $string);
  return $string;
}


function truncate($str, $id) {

$len = '200'; //This is how many characters are displayed.
$splitter = '<!--MORE-->';
$append = ' ... <span class="barlink"><i><a href="viewtopic.php?pid='.$id.'#p'.$id.'"';
    if(strlen($str) <= $len){
        return $str;
    }
    if($len > 0 && !strstr($str,$splitter)){
        preg_match('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){'.$len.',}\b#U', $str,$matches);
        $str = $matches[0];
        # remove trailing opener tags and close all other open tags:
        $str = close_tags(preg_replace('#\s*<[^>]+>?\s*$#','',$str).$append);
    } else {
        $arr = explode($splitter,$str,2);
        $str = $arr[0];
    }
    return $str;
}

if ($pun_config['o_index_message_show'] == 1)
{
?>
 
        <div class="block">
            <h2><span><?php echo pun_htmlspecialchars($pun_config['o_index_message_head']) ?></span></h2>
            <div class="box">
                <div class="inbox">
        <?php echo $pun_config['o_index_message'] ?>
                </div>
            </div>
        </div>
<?php
}
$result = $db->query('SELECT t.id, t.subject, t.num_replies, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.forum_id, u.use_avatar, p.id AS post_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))
                            {
$id = ($cur_post['post_id']);
                                    $pre = parse_message($cur_post['message'], $cur_post['hide_smilies']);
$str = truncate ($pre, $id);
?>
    <div class="block">
       
<?php
        if ($pun_config['o_avatars'] == '1' && $cur_post['use_avatar'] == '1' && $pun_user['show_avatars'] != '0')
        {
            if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif'))
                $user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" /></a>';
            else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg'))
                $user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" /></a>';
            else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png'))
                $user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" /></a>';
        }
        else
            $user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img alt="" src="img/noimage.gif" /></a>';
    echo "\t\t\t\t\t\t\t".'<h2><strong><a href="forum.php">Forum</a> » <a href="viewforum.php?id='.$cur_post['forum_id'].'">'.pun_htmlspecialchars($cur_post['forum_name']).'</a>'.'</strong></h2>'."\n";
?>
<div class="box">
    <div class="inbox">
<ul><li>
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
    <tr>
        <td style="border: 0px; padding: 0px 10px 7px 7px;"><a class="news_subject" href="viewtopic.php?id=<?php echo $cur_post['id']; ?>"><?php echo $cur_post['subject']; ?></a></td>
    </tr>
</table> 
 
<table cellSpacing="0" cellPadding="0" width="100%" border="0">
    <tr>
        <td align="left" style="white-space: nowrap; width: 8em; padding-left: 7px; padding-top: 6px; padding-bottom: 30px; border: 0px;" valign="top"><?php echo $user_avatar ?></td>
        <td style="text-align: left; border: 0px; padding-top: 0px;" valign="top"><?php echo $str ?></td>
    </tr>
</table>

<table class="news_footer" cellpadding="0" cellspacing="0" width="100%">
    <tr>
        <td width="100%">
            
            <?php
    echo "\t\t\t\t\t\t\t".'<span class="user" style="float:left">Posted: '.format_time($cur_post['posted']).' by:<span class="user'.(isset($cur_post['g_title']) ? ' '.strtolower(str_replace(' ', '', $cur_post['g_title'])) : '').'"> <a class="poster" href="profile.php?id='.$cur_post['poster_id'].'">'.pun_htmlspecialchars($cur_post['poster']).'</a> |  Views: '. $cur_post['num_views'].' |  Replies: '. $cur_post['num_replies'].'</span></span>'."\n";
        if ($cur_post['poster_id'] == $pun_user['id'] || $pun_user['g_id'] < PUN_GUEST)
    echo "\t\t\t\t\t\t\t".'<a href="viewtopic.php?id='.$cur_post['id'].'">'.pun_htmlspecialchars($lang_portal['Visit_Topic']).'</a>'.'<span style="float:right">'.'<a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a>'.' | <a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a> | <a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>'.' | <a href="post.php?tid='.$cur_post['id'].'">'.'Reply'.'</a>'.' | <a href="post.php?tid='.$cur_post['id'].'&qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a>'.' | <a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_post['id'].'">'.'Read More'.'</a>'.'</span>'."\n\n\n\n";
?>
        </td>
    </tr>
</table>       
</li></ul>
        </div>
    </div>
</div>
<?
}
     }

require PUN_ROOT.'footer.php';
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 !!!

87 (edited by MattF 2007-06-23 20:34)

Re: New frontpage index mod!

You need to set $trunc_chars, in both places it occurs, to the character truncation limit. It occurs once near the top of the file, and again in the second function, near the top of the file. Set both to the same number. Here's the file:

http://outgoing.bauchan.org/unix/index.php.txt

Edit: Btw, hope you don't mind me neatening the code up a tad whilst I had it? big_smile big_smile

88

Re: New frontpage index mod!

soonotes wrote:

Try this

Bugger. Just posted the one I'd done before I noticed you'd already posted one. big_smile big_smile

89

Re: New frontpage index mod!

bingiman wrote:

Don't mean to be a pain soonotes but is there a way for this to display more than one forum?

Try this one. The lines near the top:

$newsid[] = '1';
$newsid[] = '2';

Just add extra lines with each forum id, i.e:

$newsid[] = '3';
$newsid[] = '4';

Untested but should work.

http://outgoing.bauchan.org/unix/multi-index.php.txt

Re: New frontpage index mod!

looks and works great. How do I get the ... at the end of the truncated text as soonotes had in his own?

91 (edited by bingiman 2007-06-23 21:13)

Re: New frontpage index mod!

I see a slight problem in the script. If I set it to 350 characters and my text is below that it still displays the read more link.

92

Re: New frontpage index mod!

bingiman wrote:

I see a slight problem in the script. If I set it to 350 characters and my text is below that it still displays the read more link.

Dots appended: http://outgoing.bauchan.org/unix/multi-index1.php.txt

Have you set both $trunc_chars settings to the same number? If so, the read more link should just become '- -' if the message is below the character limit.

Re: New frontpage index mod!

Hi MattF,

below is my final script with all the changes etc. This one works perfectly and I figured out the append stuff just before I read this post (pats himself on the back big_smile)

Anyway, I also made some changes to the Read More area. If there was nothing more to read you still had the ||. I've eliminated that with a few changes. Here is it:

<?php
 
define('PUN_ROOT', './');
require_once PUN_ROOT.'include/common.php';
 
//Set the page title here
$page_title = pun_htmlspecialchars($pun_config['o_board_title']);

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

$newsid = array();    //These are the forums the news is retrieved from.
$newsid[] = '1';
$newsid[] = '2';

$newsdisplay = '5';    //This is how many news articles are displayed.
$trunc_chars = '350';    //Amount of characters before truncation occurs.

if ($pun_config['o_index_message_show'] == 1)
{
?>
    <div class="block">
        <h2><span><?php echo pun_htmlspecialchars($pun_config['o_index_message_head']) ?></span></h2>
        <div class="box">
            <div class="inbox">
            <?php echo $pun_config['o_index_message'] ?>
            </div>
        </div>
    </div>
<?php
}

//----------------------------------------------------------------------//

function close_tags($string)
{
    if (preg_match_all ('/<([a-z]+)[ >]/', $string, $start_tags))
    {
        $start_tags = $start_tags[1];

        if (preg_match_all ('/<\/([a-z]+)>/', $string, $end_tags))
        {
            $complete_tags = array();
            $end_tags = $end_tags[1];

            foreach ($start_tags as $key => $val)
            {
                $posb = array_search ($val, $end_tags);
                if (is_integer ($posb))
                {
                    unset ($end_tags[$posb]);
                }
                else
                {
                    $complete_tags[] = $val;
                }
            }
        }
        else
        {
            $complete_tags = $start_tags;
        }

        $complete_tags = array_reverse ($complete_tags);
        for ($i = 0; $i < count ($complete_tags); $i++)
        {
            $string .= '</' . $complete_tags[$i] . '>';
        }
    }

        // Removes irrelevant tags
    $xhtml_tags = array ('</img>', '</hr>', '</br>');
    $string = str_replace ($xhtml_tags, '', $string);
    return $string;
}

//----------------------------------------------------------------------//

function truncate($string)
{
global $pun_config;
$trunc_chars = '350';
$length = $trunc_chars;

    if (strlen ($string) <= $length)
    {
        return $string;
    }
    else if ($length > 0)
    {$append = '...';
        preg_match ('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){'.$length.',}\b#U', $string, $matches);
        $string = $matches[0];
        $string = close_tags (preg_replace ('#\s*<[^>]+>?\s*$#', '', $string).$append);
        return $string;
    }
}

//----------------------------------------------------------------------//

foreach ($newsid as $forum)
{
$result = $db->query('SELECT t.id, t.subject, t.num_replies, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.forum_id, u.use_avatar, 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='.$forum.' 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))
    {
        echo '<div class="block">';
        if ($pun_config['o_avatars'] == '1' && $cur_post['use_avatar'] == '1' && $pun_user['show_avatars'] != '0')
        {
            if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif'))
            {
                $user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" /></a>';
            }
            else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg'))
            {
                $user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" /></a>';
            }
            else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png'))
            {
                $user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" /></a>';
            }
        }
        else
        {
            $user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img alt="" src="img/noimage.gif" /></a>';
        }

        $news_message = parse_message($cur_post['message'], $cur_post['hide_smilies']);

        if (pun_strlen($news_message) > $trunc_chars)
        {
            $news_message = truncate($news_message);
            $read_more = ' <a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_post['id'].'">Read More</a> |';
        }
        else
        {
            $read_more = '';
        }


        echo "\t\t\t\t\t\t\t".'<h2><strong><a href="forum.php">Forum</a> » <a href="viewforum.php?id='.$cur_post['forum_id'].'">'.pun_htmlspecialchars($cur_post['forum_name']).'</a>'.'</strong></h2>'."\n";
?>
    <div class="box">
        <div class="inbox">
        <ul><li>
        <table cellSpacing="0" cellPadding="0" width="100%" border="0">
            <tr>
            <td style="border: 0px; padding: 0px 10px 7px 7px;"><a class="news_subject" href="viewtopic.php?id=<?php echo $cur_post['id']; ?>"><?php echo $cur_post['subject']; ?></a></td>
            </tr>
        </table> 
        <table cellSpacing="0" cellPadding="0" width="100%" border="0">
            <tr>
            <td align="left" style="white-space: nowrap; width: 8em; padding-left: 7px; padding-top: 6px; padding-bottom: 30px; border: 0px;" valign="top"><?php echo $user_avatar ?></td>
            <td style="text-align: left; border: 0px; padding-top: 0px;" valign="top"><?php echo $news_message."\n" ?></td>
            </tr>
        </table>
        <table class="news_footer" cellpadding="0" cellspacing="0" width="100%">
            <tr>
            <td width="100%">
<?php
                echo "\t\t\t\t\t\t\t".'<span class="user" style="float:left">Posted: '.format_time($cur_post['posted']).' by:<span class="user'.(isset($cur_post['g_title']) ? ' '.strtolower(str_replace(' ', '', $cur_post['g_title'])) : '').'"> <a class="poster" href="profile.php?id='.$cur_post['poster_id'].'">'.pun_htmlspecialchars($cur_post['poster']).'</a> |'.$read_more.' Views: '.$cur_post['num_views'].' |  Replies: '. $cur_post['num_replies'].'</span></span>'."\n";

                if ($cur_post['poster_id'] == $pun_user['id'] || $pun_user['g_id'] < PUN_GUEST)
                {
                    echo "\t\t\t\t\t\t\t".'<a href="viewtopic.php?id='.$cur_post['id'].'">'.pun_htmlspecialchars($lang_portal['Visit_Topic']).'</a>'.'<span style="float:right">'.'<a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a>'.' | <a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a> | <a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>'.' | <a href="post.php?tid='.$cur_post['id'].'">'.'Reply'.'</a>'.' | <a href="post.php?tid='.$cur_post['id'].'&qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a>'.'</span>'."\n\n\n\n";
                }
?>
            </td>
            </tr>
        </table>       
        </li></ul>
        </div>
    </div>
</div>
<?php
    }
}
}

require PUN_ROOT.'footer.php';
?>

Thank you for ALL your hard work mate, and thanks to quaker and soonotes. You guys are awesome!

Re: New frontpage index mod!

Won't that order posts by the forum they are in rather than the order they were posted though?

Re: New frontpage index mod!

hmm..Maybe MattF can look into that. I also found a problem. If I set for example 2 forums to display then the max setting which is (5) really has no effect. It displays way more than that. If however I remove the second forum, then it displays the correct amount of posts. Any solution for this issue and the one Connorhd mentioned.

Cheers!

96

Re: New frontpage index mod!

Connorhd wrote:

Won't that order posts by the forum they are in rather than the order they were posted though?

The order they were posted per forum, in forum chunks, yes. Ordering them by creation time irrelevant of forum would be a bit of a rewrite, though. big_smile Besides, unless it's just me with an unusual way of thinking, per forum creation order does seem more logical than per creation order overall for the list ordering. The script could then accomodate some type of division to split the table layout between forum sections. (Btw, the above does make perfect sense in my head, but may appear a bit rambling, by the looks of this post). big_smile big_smile

97

Re: New frontpage index mod!

bingiman wrote:

hmm..Maybe MattF can look into that. I also found a problem. If I set for example 2 forums to display then the max setting which is (5) really has no effect. It displays way more than that. If however I remove the second forum, then it displays the correct amount of posts. Any solution for this issue and the one Connorhd mentioned.

Cheers!

Right. We'll start afresh. What do you want the script to do? Rather than adding bits that you want to the script you had, what exactly do you want the script to achieve, working from a blank start? Btw, the max setting is per forum, not overall.

Re: New frontpage index mod!

...and what about my last post sad

99

Re: New frontpage index mod!

bingiman wrote:

...and what about my last post sad

In what regard? If you say what you're wanting the script to do, overall, we can skip the piecemeal approach and see if the script is workable for what you actually *want* it to do, rather than adding bits which don't. Make a list. (A specifically defined and explanatory one). smile smile

100

Re: New frontpage index mod!

Since i started this script... basically i wanted it to show the top post from every forum id.
bing has added a lot of functions and we continue to make it grow with more stuff.
Q
demo are in order and http://nalan.org/ 1.php threw 7.php as you can see the changes.
http://nalan.org/7.php is the last one.
my lastest code work.

<?php
 
define('PUN_ROOT', './');
require_once PUN_ROOT.'include/common.php';
 
//Set the page title here
$page_title = pun_htmlspecialchars($pun_config['o_board_title']);

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

$newsid = array();    //These are the forums the news is retrieved from.
$newsid[] = '1';
$newsid[] = '4';

$newsdisplay = '5';    //This is how many news articles are displayed.
$trunc_chars = '350';    //Amount of characters before truncation occurs.

if ($pun_config['o_index_message_show'] == 1)
{
?>
    <div class="block">
        <h2><span><?php echo pun_htmlspecialchars($pun_config['o_index_message_head']) ?></span></h2>
        <div class="box">
            <div class="inbox">
            <?php echo $pun_config['o_index_message'] ?>
            </div>
        </div>
    </div>
<?php
}

//----------------------------------------------------------------------//

function close_tags($string)
{
    if (preg_match_all ('/<([a-z]+)[ >]/', $string, $start_tags))
    {
        $start_tags = $start_tags[1];

        if (preg_match_all ('/<\/([a-z]+)>/', $string, $end_tags))
        {
            $complete_tags = array();
            $end_tags = $end_tags[1];

            foreach ($start_tags as $key => $val)
            {
                $posb = array_search ($val, $end_tags);
                if (is_integer ($posb))
                {
                    unset ($end_tags[$posb]);
                }
                else
                {
                    $complete_tags[] = $val;
                }
            }
        }
        else
        {
            $complete_tags = $start_tags;
        }

        $complete_tags = array_reverse ($complete_tags);
        for ($i = 0; $i < count ($complete_tags); $i++)
        {
            $string .= '</' . $complete_tags[$i] . '>';
        }
    }

        // Removes irrelevant tags
    $xhtml_tags = array ('</img>', '</hr>', '</br>');
    $string = str_replace ($xhtml_tags, '', $string);
    return $string;
}

//----------------------------------------------------------------------//

function truncate($string)
{
global $pun_config;
$trunc_chars = '350';
$length = $trunc_chars;

    if (strlen ($string) <= $length)
    {
        return $string;
    }
    else if ($length > 0)
    {$append = '...';
        preg_match ('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){'.$length.',}\b#U', $string, $matches);
        $string = $matches[0];
        $string = close_tags (preg_replace ('#\s*<[^>]+>?\s*$#', '', $string).$append);
        return $string;
    }
}

//----------------------------------------------------------------------//

foreach ($newsid as $forum)
{
$result = $db->query('SELECT t.id, t.subject, t.num_replies, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.forum_id, u.use_avatar, u.num_posts, u.registered, u.title, 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='.$forum.' 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))
    {
        echo '<div class="block">';
        if ($pun_config['o_avatars'] == '1' && $cur_post['use_avatar'] == '1' && $pun_user['show_avatars'] != '0')
        {
            if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif'))
            {
                $user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" /></a>';
            }
            else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg'))
            {
                $user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" /></a>';
            }
            else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png'))
            {
                $user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png" '.$img_size[3].' title="'.$cur_post['poster'].'\'s Avatar" alt="'.$cur_post['poster'].'\'s Avatar" /></a>';
            }
        }
        else
        {
            $user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img alt="" src="img/noimage.gif" /></a>';
        }

        $news_message = parse_message($cur_post['message'], $cur_post['hide_smilies']);

        if (pun_strlen($news_message) > $trunc_chars)
        {
            $news_message = truncate($news_message);
            $read_more = ' <a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_post['id'].'">Read More</a> |';
        }
        else
        {
            $read_more = '';
        }


        echo "\t\t\t\t\t\t\t".'<h2><strong><a href="forum.php">Forum</a> » <a href="viewforum.php?id='.$cur_post['forum_id'].'">'.pun_htmlspecialchars($cur_post['forum_name']).'</a>'.'</strong></h2>'."\n";
?>
    <div class="box">
        <div class="inbox">
        <ul><li>
        <table cellSpacing="0" cellPadding="0" width="100%" border="0">
            <tr>
            <td style="border: 0px; padding: 0px 10px 7px 7px;"><a class="news_subject" href="viewtopic.php?id=<?php echo $cur_post['id']; ?>"><?php echo $cur_post['subject']; ?></a></td>
            </tr>
        </table> 
        <table cellSpacing="0" cellPadding="0" width="100%" border="0">
            <tr>
            <td align="left" style="white-space: nowrap; width: 8em; padding-left: 7px; padding-top: 6px; padding-bottom: 30px; border: 0px;" valign="top"><?php echo $user_avatar ?><p></p><strong><?php echo pun_htmlspecialchars($cur_post['poster']) ?></strong><p></p><?php echo 'Title: '.$cur_post['g_title'] ?><p></p><?php echo 'Total Post: '.$cur_post['num_posts'] ?><p></p><?php echo 'Registered Date: '. format_time($cur_post['registered'], true) ?></td>
            <td style="text-align: left; border: 0px; padding-top: 0px;" valign="top"><?php echo $news_message."\n" ?></td>
            </tr>
        </table>
        <table class="news_footer" cellpadding="0" cellspacing="0" width="100%">
            <tr>
            <td width="100%">
<?php
                echo "\t\t\t\t\t\t\t".'<span class="user" style="float:left">Posted: '.format_time($cur_post['posted']).' by:<span class="user'.(isset($cur_post['g_title']) ? ' '.strtolower(str_replace(' ', '', $cur_post['g_title'])) : '').'"> <a class="poster" href="profile.php?id='.$cur_post['poster_id'].'">'.pun_htmlspecialchars($cur_post['poster']).'</a> |'.$read_more.' Views: '.$cur_post['num_views'].' |  Replies: '. $cur_post['num_replies'].'</span></span>'."\n";

                if ($cur_post['poster_id'] == $pun_user['id'] || $pun_user['g_id'] < PUN_GUEST)
                {
                    echo "\t\t\t\t\t\t\t".'<a href="viewtopic.php?id='.$cur_post['id'].'">'.pun_htmlspecialchars($lang_portal['Visit_Topic']).'</a>'.'<span style="float:right">'.'<a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a>'.' | <a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a> | <a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>'.' | <a href="post.php?tid='.$cur_post['id'].'">'.'Reply'.'</a>'.' | <a href="post.php?tid='.$cur_post['id'].'&qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a>'.' | <a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_post['id'].'">'.'Read More'.'</a>'.'</span>'."\n\n\n\n";
                }
?>
            </td>
            </tr>
        </table>       
        </li></ul>
        </div>
    </div>
</div>
<?php
    }
}
}

require PUN_ROOT.'footer.php';
?>
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 !!!