Topic: 'Expand all forum' in viewforum.php

I need to make a minor change so it will fit with my school web site. 
I have two categories, one called Students and the other called Staff. I need to modify it such that when a user (staff member) goes into either category, the forum for each, all posts are automatically expanded.

In short, when the Students forum is clicked all posting are viewable on one page. This makes it easier for the principal to read all posted announcements for the students over the PA system.

Can anyone help?

Re: 'Expand all forum' in viewforum.php

I'm not sure what you mean. Do you mean that you want to display all topic subjects on the viewforum.php page instead of just e.g. 30?

"Programming is like sex: one mistake and you have to support it for the rest of your life."

3 (edited by wiseman 2005-01-02 20:44)

Re: 'Expand all forum' in viewforum.php

Thanks for the reply.
To clarify, when a user logs in, they will see two forums; STUDENT MESSAGES and STAFF MESSAGES (index.php page). Currently, When the user clicks on STUDENT MESSAGES, for example, they only see the listed topics for that forum (viewforum.php page), then they have to click on each topic in succession to see each message. 

I would like to change this so that when users click on STUDENT MESSAGES, the Topics,  along with the MESSAGE , are viewable all on one page.
Thanks.

Re: 'Expand all forum' in viewforum.php

Aha. Well, for that you'd have to rewrite large parts of viewforum.php.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: 'Expand all forum' in viewforum.php

i'm not sure if this is excatly what you want (and i've done it for 1.2 beta it will probably work for 1.2 final too) but open viewforum.php and replace around lines 206-218

?>
                <tr>
                    <td class="tcl">
                        <?php echo $icon ?>
                        <div class="tclcon">
                            <?php echo $subject."\n" ?>
                        </div>
                    </td>
                    <td class="tc2"><?php echo ($cur_topic['moved_to'] == null) ? $cur_topic['num_replies'] : ' ' ?></td>
                    <td class="tc3"><?php echo ($cur_topic['moved_to'] == null) ? $cur_topic['num_views'] : ' ' ?></td>
                    <td class="tcr"><?php echo $last_post ?></td>
                </tr>
<?php

with

        $resultp = $db->query('SELECT id, topic_id, message FROM '.$db->prefix.'posts WHERE topic_id='.$cur_topic['id'].' ORDER BY id LIMIT 0, 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
        $cur_topic_post = $db->fetch_assoc($resultp);
?>
                <tr>
                    <td class="tcl">
                        <?php echo $icon ?>
                        <div class="tclcon">
                            <?php echo $subject."\n" ?>
                            <blockquote>
                                <div class="incqbox">
                                    <p>
                                        <?php echo $cur_topic_post['message']; ?>
                                    </p>
                                </div>
                            </blockquote>
                        </div>
                    </td>
                    <td class="tc2"><?php echo ($cur_topic['moved_to'] == null) ? $cur_topic['num_replies'] : ' ' ?></td>
                    <td class="tc3"><?php echo ($cur_topic['moved_to'] == null) ? $cur_topic['num_views'] : ' ' ?></td>
                    <td class="tcr"><?php echo $last_post ?></td>
                </tr>
<?php

for a result of something like this
http://mypunbb.com/img/viewforum.png

Re: 'Expand all forum' in viewforum.php

if you want to have the message "parsed" e.g. smilies added and bbcode done then you will need to add

require PUN_ROOT.'include/parser.php';

below

require PUN_ROOT.'include/common.php';

at the top of view_forum.php
and replace the code with

        $resultp = $db->query('SELECT id, topic_id, message FROM '.$db->prefix.'posts WHERE topic_id='.$cur_topic['id'].' ORDER BY id LIMIT 0, 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
        $cur_topic_post = $db->fetch_assoc($resultp);
?>
                <tr>
                    <td class="tcl">
                        <?php echo $icon ?>
                        <div class="tclcon">
                            <?php echo $subject."\n" ?>
                            <blockquote>
                                <div class="incqbox">
                                    <p>
                                        <?php echo parse_message($cur_topic_post['message'],0); ?>
                                    </p>
                                </div>
                            </blockquote>
                        </div>
                    </td>
                    <td class="tc2"><?php echo ($cur_topic['moved_to'] == null) ? $cur_topic['num_replies'] : ' ' ?></td>
                    <td class="tc3"><?php echo ($cur_topic['moved_to'] == null) ? $cur_topic['num_views'] : ' ' ?></td>
                    <td class="tcr"><?php echo $last_post ?></td>
                </tr>
<?php

instead

Re: 'Expand all forum' in viewforum.php

The code you gave me works, however the color is too dark, making the text hard to read.  I tried playing playing with the code but I could not make the dark-grey lighter.  How can I use your code and reflect a lighter grey? My currect code is as follows;
Thanks for your help.



    $subject .= '  '.(!empty($subject_new_posts) ? $subject_new_posts : '');
            $subject .= !empty($subject_multipage) ? ' '.$subject_multipage : '';
        }

?>
    <tr class="puntopic">
        <td class="puncon1cent"><?php echo $icon ?></td>
        <td class="puncon2"><?php echo $subject ?></td>
        <td class="puncon1"><?php echo pun_htmlspecialchars($cur_topic['poster']) ?></td>
        <td class="puncon2cent"><?php echo ($cur_topic['moved_to'] == null) ? $cur_topic['num_replies'] : ' ' ?></td>
        <td class="puncon1cent"><?php echo ($cur_topic['moved_to'] == null) ? $cur_topic['num_views'] : ' ' ?></td>
        <td class="puncon2" style="white-space: nowrap"><?php echo $last_post ?></td>
    </tr>
<?php

Re: 'Expand all forum' in viewforum.php

well thats version 1.1.5 and i did it for 1.2 which is why its different, i'm a bit busy now but tomorrow i'll do it for 1.1.5, although 1.2 should be out in a day or two wink

Re: 'Expand all forum' in viewforum.php

replace that with

                $resultp = $db->query('SELECT id, topic_id, message FROM '.$db->prefix.'posts WHERE topic_id='.$cur_topic['id'].' ORDER BY id LIMIT 0, 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
                $cur_topic_post = $db->fetch_assoc($resultp);
?>
            <tr class="puntopic">
                <td class="puncon1cent"><?php echo $icon ?></td>
                <td class="puncon2">
                    <?php echo $subject ?><br>
                    <table style="width: 95%" align="center" cellspacing="4" cellpadding="6"><tr><td class="punquote"><span class="puntext"><?php echo $cur_topic_post['message']; ?></span></td></tr></table>
                </td>
                <td class="puncon1"><?php echo pun_htmlspecialchars($cur_topic['poster']) ?></td>
                <td class="puncon2cent"><?php echo ($cur_topic['moved_to'] == null) ? $cur_topic['num_replies'] : ' ' ?></td>
                <td class="puncon1cent"><?php echo ($cur_topic['moved_to'] == null) ? $cur_topic['num_views'] : ' ' ?></td>
                <td class="puncon2" style="white-space: nowrap"><?php echo $last_post ?></td>
            </tr>
<?php

hope thats what you want

10 (edited by kiplantt 2005-01-03 15:20)

Re: 'Expand all forum' in viewforum.php

I think you want that :
http://punbb-fr.ircme.net/viewtopic.php?id=16

(it's in french)

Edit: Tell me if you want a translation.

[img]http://www.famfamfam.com/lab/icons/silk/icons/error.png[/img] /me speaks French and bad English [img]http://www.famfamfam.com/lab/icons/silk/icons/error.png[/img]

Re: 'Expand all forum' in viewforum.php

Demo :
http://www.carnetdepeche.com/punbb/

Demo after a clic on "Logiciel CAPEMER" :
http://www.carnetdepeche.com/punbb/index.php?cat=12

[img]http://www.famfamfam.com/lab/icons/silk/icons/error.png[/img] /me speaks French and bad English [img]http://www.famfamfam.com/lab/icons/silk/icons/error.png[/img]

12 (edited by Connorhd 2005-01-03 17:06)

Re: 'Expand all forum' in viewforum.php

kiplantt wrote:

I think you want that :
http://punbb-fr.ircme.net/viewtopic.php?id=16

(it's in french)

Edit: Tell me if you want a translation.

what does that actually do? i don't think its what he wants as it only affects index.php and he wants to change the viewforum page...


oh wait i see what it does it makes it o each category has its own page too? if i'm 99% sure thats not what he wants

Re: 'Expand all forum' in viewforum.php

I'm very not sure. (see my signature!)

[img]http://www.famfamfam.com/lab/icons/silk/icons/error.png[/img] /me speaks French and bad English [img]http://www.famfamfam.com/lab/icons/silk/icons/error.png[/img]

Re: 'Expand all forum' in viewforum.php

It work wonderfully!
Thank you very much for your trouble and time.

Re: 'Expand all forum' in viewforum.php

My script or one other ?

[img]http://www.famfamfam.com/lab/icons/silk/icons/error.png[/img] /me speaks French and bad English [img]http://www.famfamfam.com/lab/icons/silk/icons/error.png[/img]

Re: 'Expand all forum' in viewforum.php

Connorhd  is the script that gave me the effect I was looking for.  However, I liked how you had your site done and I may be incorporating some of your ideas. 

Thnak you for giving of your time as well.  I have found this to be a very helpful forum considering I only posted my message yesterday.

Re: 'Expand all forum' in viewforum.php

well i wrote a guide how to make my site - http://punbb.org/forums/viewtopic.php?id=5044 - its quite general so you can adapt it to what you want