Topic: PunBB Homepage News Blog

I just installed the MiniPortal for my forums but the news feeder automatically updates with each reply to the original topic.  How do I make it like the Punbb News Blog on the PunBB.org homepage so I can set a given post and people can click "comment" to go to the thread.

As of right now, when someone replies to the topic it updates and shows the latest reply on the frontpage.  I dont want that.  I want it to stay at the original post like the PunBB News Blog.

Thank you so much in advance, you guys are awesome!

2 (edited by dude07 2007-08-03 20:32)

Re: PunBB Homepage News Blog

I use this one updated with this post.. You can truncate news items and other things not possible with Miniportal code.

Re: PunBB Homepage News Blog

Burnsy86, try my index mod that dude07 links to..


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 !!!

4 (edited by Burnsy86 2007-08-04 06:44)

Re: PunBB Homepage News Blog

Thanks guys, that will get the job done!  But while you're here, I have another question...

I installed MiniPortal but it is kind of skinny, how do I increase the entire width of the forum.

For example, if it is wider then sentences would stretch across the page much longer like this one.

But as of right now, the sentences
don't stretch across very far
like this sentence right here
because it is skinny.  It isn't
THIS crammed up, but you
get the point!

Thanks guys!

Re: PunBB Homepage News Blog

you are looking for #punwrap in the cs or _css width:850px or what ever....


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: PunBB Homepage News Blog

Nice, thanks quaker, it was in the stylename.css

Now just one more thing...

Instead of having index.php and forum.php, how can I make it so the selected news topic is displayed at the top of the page with the forums below it.

What I am envisioning is the original PunBB index with a selected news topic displayed above the forums just below the header.  Does that make sense?  It would be GREAT if someone could figure out how to do that.

The reason: non-internet saavy visitors get confused by having 2 different homepages: the frontpage and then the forum index.  So I'd like the original forum index to display a selected topic right above the forums.

I hope that makes sense and whoever can figure this out is awesome!

Thanks!

Re: PunBB Homepage News Blog

You could play with the template main.tpl

FluxBB - v1.4.8

Re: PunBB Homepage News Blog

But doesn't main.tpl have an effect on every single page?  I think it does.

Re: PunBB Homepage News Blog

you can create a portal.tpl
and call it on certain pages.....

example
http://modelcrowd.com  ---------------------> portal.tpl
http://modelcrowd.com/gallery.php  -------> main.tpl


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: PunBB Homepage News Blog

Q,

Thats pretty cool.  Unfortunately I am a PHP idiot!  If you figure out how to combine index.php and forum.php to make it so the original index shows a selected news topic then please let me know, that would be great.

11

Re: PunBB Homepage News Blog

go to... http://punres.org
click on wiki across top menu
look for mini portal

that a start...
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 !!!

12 (edited by Burnsy86 2007-08-09 04:53)

Re: PunBB Homepage News Blog

Quaker,

Here is a picture exampe of what I need, I used your forum as an example: VIEW HERE (I think if you double-click it you can enlarge it to see better)

See how it has the original forum index but it also has the recent news feed posted above it?  How would I do that?

Oh I already have the miniportal installed.  I also installed the news topic for the frontpage (the link to that is in the 2nd post).  But I wanted to combine the 2 indexes into one.  I want the original PunBB index.php to display a selected topic, just like the news topic feed mod does.  The only thing is that there are 2 different indexes, the one for the homepage that displays the news feed, and then the original index of all the forum categories.  I was wondering how to combine them into one page so the original forum index displays the news feed instead of creating an entirely new frontpage and having index.php and forum.php

Does that make sense?  The picture should give you a good visual example.

Re: PunBB Homepage News Blog

Ok guys, sorry if I'm being a hassle, but I posted a link to a picture I edited in order to show you what I'm looking for.  That link is in the post above this one.

Thank you so much to anyone who can figure this out!

14

Re: PunBB Homepage News Blog

oh...
ok now i know what you are talking about
u want sidebar newest topics and forum on one page.
that all done in the main tpl.
just put ur
latesttopics mod about the
<pun_include "latesttopics.php"> example
pun_main tag
and so on.


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 !!!

15 (edited by Burnsy86 2007-08-09 08:09)

Re: PunBB Homepage News Blog

That didn't work.  Oh well...

The news topic I use isn't a mod like that, its an entire index page like in the link above, the one you edited.

16

Re: PunBB Homepage News Blog

i will give you my index.php and main.tpl
and latesttopics.

index.php

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

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';

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

//These are the forums from which the news is retrieved
$forumids = array(1,3);

//This is the overall limit for how many news items will be displayed
$master_limit = '5';

//This is the amount of characters above which truncation will occur
$trunc_chars = '50';

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

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;
$append = '...';

    if (strlen ($string) <= $length)
    {
        return $string;
    }
    else if ($length > 0)
    {
        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;
    }
}

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

$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 IN ('.implode(',', $forumids).') AND t.moved_to IS NULL AND f.redirect_url IS NULL ORDER BY t.posted DESC LIMIT '.$master_limit) 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 title="header=[<span class=\'box_username\'> '.pun_htmlspecialchars($cur_post['poster']).'] body=[<span class=\'box_info\'> Title: '.$cur_post['g_title'].'<br /> Total Post: '.$cur_post['num_posts'].'<br /> Registered Date: '. format_time($cur_post['registered'], true).']</span>" src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif" '.$img_size[3].' 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 title="header=[<span class=\'box_username\'> '.pun_htmlspecialchars($cur_post['poster']).'] body=[<span class=\'box_info\'> Title: '.$cur_post['g_title'].'<br /> Total Post: '.$cur_post['num_posts'].'<br /> Registered Date: '. format_time($cur_post['registered'], true).']</span>" src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg" '.$img_size[3].' 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 title="header=[<span class=\'box_username\'> '.pun_htmlspecialchars($cur_post['poster']).'] body=[<span class=\'box_info\'> Title: '.$cur_post['g_title'].'<br /> Total Post: '.$cur_post['num_posts'].'<br /> Registered Date: '. format_time($cur_post['registered'], true).']</span>" src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png" '.$img_size[3].' alt="'.$cur_post['poster'].'\'s Avatar" /></a>';
            }
        }
        else
        {
            $user_avatar = '<a href="profile.php?id=' . $cur_post['poster_id'] . '"><img src="img/noimage.gif" alt=""/></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 = ' | ';
        }

        if ($cur_post['num_replies'] != '0')
        {
            $replies = ' <a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_post['id'].'#p'.$cur_post['last_post_id'].'">Replies</a>: '.$cur_post['num_replies'].' ';
        }
        else
        {
            $replies = ' Replies: '.$cur_post['num_replies'].' ';
        }

        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 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 width="100%" border="0">
            <tr>
            <td style="text-align: justify; border: 0px; padding-top: 0px;" valign="top"><?php echo $news_message."\n" ?></td>
            </tr>
        </table>
        <table class="news_footer" width="100%">
            <tr>
            <td>
<?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><br/>'.$read_more.'Views: '.$cur_post['num_views'].' |'.$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="white-space: nowrap; 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 class="block">
            <h2><span>Welcome</span></h2>
            <div class="box">
                <div class="inbox">
                    <p>
                   
                    </p>
                    <p>
                   <table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td style="border: 0px"; ><h2>YouTube Video's!</h2><center> <object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/fKQRu9G6Zbk"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/fKQRu9G6Zbk" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object></td></center>
    
  </tr>
</table>
                    <p>

                </div>
            </div>
        </div>
</div>
<?php
    }
}


require PUN_ROOT.'footer.php';

latesttopics.php

 
 <div class="block">
     <h2 class="block2"><span>Top News Topics</span></h2>
        <div class="box">       
                   <?
$result = $db->query('SELECT subject, id FROM '.$db_prefix.'topics ORDER BY last_post DESC LIMIT 4') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());

while($cur_topic = $db->fetch_assoc($result))
{
    
?>
    
        
<li>»<a href="viewtopic.php?id=<?php echo $cur_topic['id']; ?>"><?php echo $cur_topic['subject']; ?></a> </li>


 
<?
}
?>

              
                  
    </div>
</div>

my portal.tpl

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
<html dir="<pun_content_direction>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<pun_char_encoding>" />
<meta name="verify-v1" content="RjWVco8IL3AdatTi5Ir5EdXjx9vjWMtnTMEFrnYBYE8=" />
<pun_head>
<style type="text/css">
    #left {
        width: 254px;
        float: right;
        
    }
    #main {
        margin-right: 264px;
    }
    #container {
        width: 100%;
        float: left;
        margin-right: -254px;
    }
</style>
</head>
<body>
 
<div id="punwrap">
<div id="pun<pun_page>" class="pun">
 
<div id="brdheader" class="block">
    <div class="box">
        <div id="brdtitle" class="inbox">
            <pun_title>
            <pun_desc>
        </div>
        <pun_navlinks>
        <pun_status>
    </div>
</div>
 
<div id="container">
    <div id="main">
    
        <pun_announcement>
    <pun_include "latesttopics.php">
        <pun_main>
        
    </div>    
</div>
 
<div id="left">    
<div class="bloque1">
        <h3><span>search</span></h3>
        <div class="buscar">
        <pun_include "search.php">            
        </div><p></p><p></p>
    </div>



    <div class="bloque2">
        <h3>Menu</h3>
        <div class="box">
        <pun_sidelinks>            
        </div><p></p><p></p>
    </div>
    <div class="bloque1">
        <h3>Random Images</h3>
        <div class="box">
            <div class="inbox">
                  <pun_include "ran.php">      
            </div>
        </div><p></p><p></p>
    </div>
    <div class="bloque2">
        <h3>Affiliates</h3>
        <div class="box">
            <div class="inbox">
              <pun_include "affiliates.php">
                    
            </div>
        </div><p></p><p></p>
    </div>
    <div class="bloque1">
        <h3>Whos Online?</h3>
        <div class="box">
        <pun_online>
        </div>
</div><p></p><p></p>
<div class="bloque2">
        <h3>Adsense</h3>
        <div class="box">
            <div class="inbox">
                <center>
<script type="text/javascript"><!--
google_ad_client = "pub-2086538475721432";
google_ad_width = 200;
google_ad_height = 200;
google_ad_format = "200x200_as";
google_ad_type = "text_image";
google_ad_channel = "";
google_color_border = "ffffff";
google_color_bg = "ffffff";
google_color_link = "FFFFFF";
google_color_text = "FFFFFF";
google_color_url = "FFFFFF";
//-->
</script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</center>      
            </div>
        </div><p></p><p></p>
    </div>
    <p></p><p></p>
</div>
 
<div class="clearer"></div>
 
<pun_footer>
 
</div>
</div>
 
</body>
</html>
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 !!!

17

Re: PunBB Homepage News Blog

I'm about to start redoing my frontpage i just want the latest topics and some of the article i have wrote but i dont want it  in a block style like the viewtopics in the forum. more or less like a written article.

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 !!!

18 (edited by Burnsy86 2007-08-10 07:58)

Re: PunBB Homepage News Blog

Ok we are getting much closer to what I'm looking for.  Now, how would I be able to get this feature onto the ORIGINAL PunBB index that shows all the forum categories, etc:

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

//These are the forums from which the news is retrieved
$forumids = array(1,3);

//This is the overall limit for how many news items will be displayed
$master_limit = '5';

//This is the amount of characters above which truncation will occur
$trunc_chars = '50';

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

How would I get that feature onto the ORIGINAL PunBB index that shows all of the forum categories?

The index you use is for a frontpage.  How can I get this news feeder onto the original punbb index?

That is what I'm trying to do, we're getting closer!

19

Re: PunBB Homepage News Blog

how to display the truncate on the forum page. if u look at the main.tpl u can place a <pun_include'file.php"> and it will display the file there.
that index mod that i made is a stand alone page. I will have to create a mod for that to be displayed on any page.

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: PunBB Homepage News Blog

Ok, yes, that is exactly what I am talking about.  I'm glad we are on the same page now.  So you can't use that page you made because it is a stand alone page.  I understand you can use the <pun_include> because I use that for the login mod.  But I wanted to know how I can do that with the news feeder that you made.

Glad we are understanding eachother now!  If you ever make that a mod that can be added in main.tpl with <pun_include> then please let me know, that would be awesome.

Thanks for all your time and help!

21

Re: PunBB Homepage News Blog

the news feeder pulls the last 10 topics and only displays there subject in a block.
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 !!!

22 (edited by Burnsy86 2007-08-11 01:14)

Re: PunBB Homepage News Blog

when I say "news feeder" I am referring to the index page you made that displays the entire post.

23

Re: PunBB Homepage News Blog

oh ok...

ill try to work on the mod for you tomorrow..
im thinking of going hiking take some photos...

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: PunBB Homepage News Blog

Awesome, thanks!  Keep me updated.  You're a great guy and thanks for all your help!

Re: PunBB Homepage News Blog

Any news on that mod?