I just understand ... I saw the loop too simple. I have an early idea which should work.

Thank you. I will still read the code a dozen times. It's going to come!

It was to display image with a id to use it for a collapse.

Because all h2 tag has a unique class and is not practical with javascript.

But I still understand why the condition allows the display of "test 4" since it is closed before the echo.

This is the effect of the output buffering?

In fact if I want to make sure to display information just before the <h2> of each category through the hook.

I can't. And even reading the source code several times I do not understand why paragraphs "test 1", "test 2", and "test 3" displayed above and below the first <h2>.

While "test 4" appears well above the first and second category.

H1 Forum Name

P test 1
P test 2
P test 3
P test 4

H2 Category 1

P test 1
P test 2
P test 3

Forum     Topics     Posts     Last post
Forum 1 0     0     Never

P test 4

H2 Category 2

Forum     Topics     Posts     Last post
Forum 1    0     0     Never

Hello,

Sorry for my English pitiful! (Thanks Google)

But I try to use that hook to add a feature at the top of each category on the main page and I faced a strange result.

So I have been testing directly in the source code, and I am more and more perplexed.       

Test beginning at line 109 in index.php

while ($cur_forum = $db->fetch_assoc($result))
{
    ($hook = get_hook('in_forum_loop_start')) ? eval($hook) : null;
    echo '<p>test 1</p>';

    $pun_page['item_mods'] = '';
    ++$pun_page['item_count'];
    echo '<p>test 2</p>';
    if ($cur_forum['cid'] != $pun_page['cur_category'])    // A new category since last iteration?
    {
    echo '<p>test 3</p>';
        if ($pun_page['cur_category'] != 0)
        {

?>
            </tbody>
        </table>
    </div>
<?php

        }
    echo '<p>test 4</p>';

And the result in html source code.

    <h1><span>Dev Beta</span></h1>
<p>test 1</p><p>test 2</p><p>test 3</p><p>test 4</p>    <div class="main-head">
        <h2><span>truc</span></h2>

    </div>

    <div id="category1" class="main-content category">
        <table cellspacing="0" summary="Listing of forums in the category truc.">
            <thead>
                <tr>
                    <th class="tcl" scope="col">Forum</th>
                    <th class="tc2" scope="col">Topics</th>

                    <th class="tc3" scope="col">Posts</th>
                    <th class="tcr" scope="col">Last post</th>
                </tr>
            </thead>
            <tbody class="statused">
                <tr id="forum3" class="odd normal">
                    <td class="tcl"><span class="status normal" title="Forum"><img src="http://localhost/punbb13/style/Oxygen/status.png" alt="Forum" /></span> <h3><a href="http://localhost/punbb13/viewforum.php?id=3"><span>test</span></a></h3></td>

                    <td class="tc2">0</td>
                    <td class="tc3">0</td>
                    <td class="tcr">Never</td>
                </tr>
<p>test 1</p><p>test 2</p><p>test 3</p>            </tbody>
        </table>

    </div>
<p>test 4</p>    <div class="main-head">
        <h2><span>tyu</span></h2>
    </div>

    <div id="category2" class="main-content category">
        <table cellspacing="0" summary="Listing of forums in the category tyu.">
            <thead>

                <tr>
                    <th class="tcl" scope="col">Forum</th>
                    <th class="tc2" scope="col">Topics</th>
                    <th class="tc3" scope="col">Posts</th>
                    <th class="tcr" scope="col">Last post</th>
                </tr>
            </thead>

            <tbody class="statused">
                <tr id="forum4" class="odd normal">
                    <td class="tcl"><span class="status normal" title="Forum"><img src="http://localhost/punbb13/style/Oxygen/status.png" alt="Forum" /></span> <h3><a href="http://localhost/punbb13/viewforum.php?id=4"><span>azerty</span></a></h3></td>
                    <td class="tc2">0</td>
                    <td class="tc3">0</td>
                    <td class="tcr">Never</td>

                </tr>
            </tbody>
        </table>
    </div>

What do you think? I missed a step?

Thx.