Re: PunBB Miniportal v1.2.x

Actually I used XuMix's mod found here
http://punbb.org/forums/viewtopic.php?id=7039

did a few edits to the News page to make it work with the style and included it in what I call portal.php

Re: PunBB Miniportal v1.2.x

ted wrote:

Yes I could log into the forum fine before changing index.php to forum.php and the necessary changes to viewtopic, viewforum, and functions.

i really don't know, if your using IE maybe try it in Firefox? or vice versa

as for changing the look i'm busy atm but you need to edit the function in index.php to change the style of the news, i'll have a look later maybe

Re: PunBB Miniportal v1.2.x

I've already change the style of the news for my self by putting all news together into one Inbox and view only the 80 characters of the news. My purpose is to save space so it won't get to bigger at the page.

Try to take a look at my site. If you like I can share it with you.

54

Re: PunBB Miniportal v1.2.x

I think I figured out why the login wasn't working and in trying to fix it I have completely hosed the forum.  As I said before the problem was that the news work fine, but when you logged off, you couldn't log back into the forum, news yes but not the forum. 

When I loaded the forum my url was (www.first.com/forum)  I have since changed to url to (www.second.com).  I noticed that even thought I was on the news page at www.first.com/news.php when clicking on the link in news it was going to www.second.com/...  So I went to admin>options and changed the base url.  Now, I can not log off from www.second.com and I can not log in from www.first.com.  To make matters worse I tried to change the permissions for a topic and it said I couldn't because the referring url was bad.   Both URLs point to the same place by the way.

Any suggestions as to how to fix this?

55

Re: PunBB Miniportal v1.2.x

Sorry to post a million in a row.  I deleted all four cookies.  ted@newdomain, ted@olddomain, ted@www.newdomain, ted@www.olddomain.  Now I can log on and off just fine from either domain, but I can't change permissions.  I get an error saying that it is a bad http referal.  That happens from all permutations of logged in logged out each domain, domain set as base in the options, and the domain I am doing it from.

I am going to wait to see if anyone from here says, "Oh that is easy it is x."  But if that doesn't happen, I am just going to delete punbb from the server, delete all the tables from mysql, and reload it.  That should fix it. 

That isn't as terrible as it sounds.  I just loaded this on Friday and the only data in it is test posts that I have done.  The site isn't released yet.

Re: PunBB Miniportal v1.2.x

if your forum and the news page are being accessed from the same domain and subdomain it should be ok

57

Re: PunBB Miniportal v1.2.x

Austral wrote:

Connorhd

How I can separate news from one day, in index.php?

P.S. my bad english sad

http://hostel.nstu.ru/~xumuk/index.zip
???, ?????? ??? ????????? ????? ? ???????? ? ??????? ?????, ? ????? ???????? ???? ?????, ??????? ??? ??????

58

Re: PunBB Miniportal v1.2.x

ok i have tryed by myself but its really not getting anywhere
#1: In one of the category i made a forum called news section wich is the one i am linking to my miniportal how can i make it so only the first post of each thread is shown in the miniportal and not the reply.
#2: to the online box i am trying to add the "Newest registered user:"

Re: PunBB Miniportal v1.2.x

#1: In one of the category i made a forum called news section wich is the one i am linking to my miniportal how can i make it so only the first post of each thread is shown in the miniportal and not the reply.

it only displays the first post anyway

60

Re: PunBB Miniportal v1.2.x

oh ok it wont display the reply wow cool then ...problem solved thx!

Re: PunBB Miniportal v1.2.x

Look at this
http://ph4t.ath.cx/viewforum.php?id=7

Wtf happend?
it happend only in the messeges index...

how can i fix this ?

Re: PunBB Miniportal v1.2.x

looks like you messed up on something when you put in the "Who's Onlne part"

Re: PunBB Miniportal v1.2.x

I didn't mess anything, I followed everything in this guide..

64 (edited by Paul 2005-04-20 12:48)

Re: PunBB Miniportal v1.2.x

You have two divs on the left both with id=left. Since both divs are floats then their natural inclination is to line up next to each other if there is nothing on the right to stop them. You will find that if you post a couple more topics making the right hand table longer then the problem will go away.

I don't know whether this is a design fault or whether you have got the markup wrong but the whole left column should really be inside one container div not split into two floating divs.

Re: PunBB Miniportal v1.2.x

your code

<!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>" />
<pun_head>
<style type="text/css">
    #left {
        width: 140px;
        float: left;
    }
    #main {
        margin-left: 150px;
    }
    #container {
        width: 100%;
        float: right;
        margin-left: -140px;
    }
</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_main>
        
    </div>    
</div>

<div id="left">    
    <div class="block">
        <h2><span>Menu</span></h2>
        <div class="box">
        <pun_sidelinks>            
        </div>
    </div>
    <div class="block">
        <h2 class="block2"><span>More Links</span></h2>
        <div class="box">
            <div class="inbox">
                <ul>
                    <li><a href="http://kungfucinema.com">Kung Fu Cinema</a></li>

                </ul>        
            </div>
        </div>
    </div>
</div>
<div id="left">    
    <div class="block">
        <h2 class="block2"><span>Whos Online?</span></h2>
        <div class="box">
        <pun_online>
        </div>
    </div>
    <div class="block">
        <h2 class="block2"><span>Latest Posts</span></h2>
        <div class="box">
            <div class="inbox">
                <ul>
                    <pun_include "http://ph4t.ath.cx/extern.php?action=active">
                </ul>        
            </div>
        </div>
    </div>
</div>
<div class="clearer"></div>

<pun_footer>

</div>
</div>

</body>
</html>

what it should be

<!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>" />
<pun_head>
<style type="text/css">
    #left {
        width: 140px;
        float: left;
    }
    #main {
        margin-left: 150px;
    }
    #container {
        width: 100%;
        float: right;
        margin-left: -140px;
    }
</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_main>
        
    </div>    
</div>

<div id="left">    
    <div class="block">
        <h2><span>Menu</span></h2>
        <div class="box">
        <pun_sidelinks>            
        </div>
    </div>
    <div class="block">
        <h2 class="block2"><span>More Links</span></h2>
        <div class="box">
            <div class="inbox">
                <ul>
                    <li><a href="http://kungfucinema.com">Kung Fu Cinema</a></li>
                </ul>        
            </div>
        </div>
    </div>
    <div class="block">
        <h2 class="block2"><span>Whos Online?</span></h2>
        <div class="box">
        <pun_online>
        </div>
    </div>
    <div class="block">
        <h2 class="block2"><span>Latest Posts</span></h2>
        <div class="box">
            <div class="inbox">
                <ul>
                    <pun_include "http://ph4t.ath.cx/extern.php?action=active">
                </ul>        
            </div>
        </div>
    </div>
</div>
<div class="clearer"></div>

<pun_footer>

</div>
</div>

</body>
</html>

Re: PunBB Miniportal v1.2.x

Connorhd tnx! problem fixed smile

67

Re: PunBB Miniportal v1.2.x

Ataxy wrote:

is there anyway of making it display info from a category instead of a forum or how can i make it display news from more then one forum id

Ataxy wrote:

#2: to the online box i am trying to add the "Newest registered user:"

hey any news on how i could do those two thing ...that is if you had time

Re: PunBB Miniportal v1.2.x

shinko_metsuo wrote:

What would I need to edit to get avatars in the news page?

Disclaimer: I haven't used the mini-portal yet, but I'm making a little news blog for the front page of my site, and I wanted avatars to appear in news posts, so this is a hack of my hack for your use. I also assume that since you have the user-name of the person who posted, you have access to the user-id from the post. I will assume this is loaded into $id.

$rel_path="http://path-to-your-forums.com/forums/";
$user_avatar = '';     

        if ($img_size = @getimagesize($rel_path.$pun_config['o_avatars_dir'].'/'.$id.'.gif'))
                $user_avatar = '<img src="'.$rel_path.$pun_config['o_avatars_dir'].'/'.$id.'.gif" '.$img_size[3].' alt="" />';
        else if ($img_size = @getimagesize($rel_path.$pun_config['o_avatars_dir'].'/'.$id.'.jpg'))
                $user_avatar = '<img src="'.$rel_path.$pun_config['o_avatars_dir'].'/'.$id.'.jpg" '.$img_size[3].' alt="" />';
        else if ($img_size = @getimagesize($rel_path.$pun_config['o_avatars_dir'].'/'.$id.'.png'))
                $user_avatar = '<img src="'.$rel_path.$pun_config['o_avatars_dir'].'/'.$id.'.png" '.$img_size[3].' alt="" />';

To display the avatar, simply use

echo $user_avatar;

If there is no avatar for this user, $user_avatar will still equal a null string ("") and therefor display nothing.

You can probably get rid of the $rel_path as long as you are in the forums root, but this will make sure it will work if called from another directory which is my needs. :-)

Re: PunBB Miniportal v1.2.x

Where do I put echo $user_avatar; I've tryed everywhere it doesn't show or I get an error

also you shouldn't need $rel_path as long as you have your PUN_ROOT defined and use it.

Re: PunBB Miniportal v1.2.x

shinko_metsuo:

first of all that script will need editing to work with the miniportal

also $rel_path is not the same as PUN_ROOT, although you won't need it for the miniportal

Re: PunBB Miniportal v1.2.x

yeah I'm working on it now smile

Re: PunBB Miniportal v1.2.x

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 = 'Posted by '.$cur_topic['poster'].' | '.format_time($cur_topic['posted']).' | <a href="'.$pun_config['o_base_url'].'/viewtopic.php?id='.$cur_topic['id'].'&action=new">Comments ('.$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'] .= '…';
            }
        }

        // View avatar
        $user_avatar = '';

        if ($pun_config['o_avatars'] == '1')
        {
            if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif'))
                $user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif" '.$img_size[3].' alt="" />';
            else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg'))
                $user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg" '.$img_size[3].' alt="" />';
            else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png'))
                $user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png" '.$img_size[3].' alt="" />';
        }
        else
            $user_avatar = '';

        $temp .= '<label class="conl">'.$user_avatar.'</label>';
        $temp .= '<div class="box" style="padding:5px; margin:4px;">'.$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;
}

I've modified pun_news to show avatars & comments, not perfect but it's enough for me

73 (edited by shinko_metsuo 2005-04-29 23:22)

Re: PunBB Miniportal v1.2.x

Connorhd I found a bug. On the news page when my other admin commented to the post his post showed on the news instead of mine. I hope you have a fix.

Edit: it also says its posted by me when its not

Re: PunBB Miniportal v1.2.x

did you use the original pun_news? (the one in the first post)

Re: PunBB Miniportal v1.2.x

yes I did and it is still like that