1 (edited by Arvid 2005-08-11 15:26)

Topic: Unwanted character shows above footer (resolved)

I've decided to change from forumer.com (a forumhost using Invision) to PunBB and i'm in the middle of setting it up like i want it before i make the switch. Doing so i have probably done something i shouldn't with the code, because there is a "<" displayed right above the footer that should not be there (see pic)..

http://stadsparksvallen.se/forum.gif

I don't know much about these things so i don't try to mess too much with the code, but i installed a few mods that required some code editing, and since then this little bugger have been there. The mods i installed are mods PMS 1.2.1 and New Window Link. I assume it's something wrong in footer.php, so i include it here. Maybe one of you guys can spot the error and help me out?

<?php
/***********************************************************************

  Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)

  This file is part of PunBB.

  PunBB is free software; you can redistribute it and/or modify it
  under the terms of the GNU General Public License as published
  by the Free Software Foundation; either version 2 of the License,
  or (at your option) any later version.

  PunBB is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  MA  02111-1307  USA

************************************************************************/


// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
    exit;

$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('<pun_main>', $tpl_temp, $tpl_main);
ob_end_clean();
// END SUBST - <pun_main>


// START SUBST - <pun_footer>
ob_start();

?>
<div id="brdfooter" class="block">
    <h2><span><?php echo $lang_common['Board footer'] ?></span></h2>
    <div class="box">
        <div class="inbox">
<?php

// If no footer style has been specified, we use the default (only copyright/debug info)
$footer_style = isset($footer_style) ? $footer_style : NULL;
require(PUN_ROOT.'include/pms/footer_links.php');

if ($footer_style == 'index' || $footer_style == 'search')
{
    if (!$pun_user['is_guest'])
    {
        echo "\n\t\t\t".'<dl id="searchlinks" class="conl">'."\n\t\t\t\t".'<dt><strong>'.$lang_common['Search links'].'</strong></dt>'."\n\t\t\t\t".'<dd><a href="search.php?action=show_24h">'.$lang_common['Show recent posts'].'</a></dd>'."\n";
        echo "\t\t\t\t".'<dd><a href="search.php?action=show_unanswered">'.$lang_common['Show unanswered posts'].'</a></dd>'."\n";

        if ($pun_config['o_subscriptions'] == '1')
            echo "\t\t\t\t".'<dd><a href="search.php?action=show_subscriptions">'.$lang_common['Show subscriptions'].'</a></dd>'."\n";

        echo "\t\t\t\t".'<dd><a href="search.php?action=show_user&user_id='.$pun_user['id'].'">'.$lang_common['Show your posts'].'</a></dd>'."\n\t\t\t".'</dl>'."\n";
    }
    else
    {
        if ($pun_user['g_search'] == '1')
        {
            echo "\n\t\t\t".'<dl id="searchlinks" class="conl">'."\n\t\t\t\t".'<dt><strong>'.$lang_common['Search links'].'</strong></dt><dd><a href="search.php?action=show_24h">'.$lang_common['Show recent posts'].'</a></dd>'."\n";
            echo "\t\t\t\t".'<dd><a href="search.php?action=show_unanswered">'.$lang_common['Show unanswered posts'].'</a></dd>'."\n\t\t\t".'</dl>'."\n";
        }
    }
}
else if ($footer_style == 'viewforum' || $footer_style == 'viewtopic')
{
    echo "\n\t\t\t".'<div class="conl">'."\n";

    // Display the "Jump to" drop list
    if ($pun_config['o_quickjump'] == '1')
    {
        // Load cached quickjump
        @include PUN_ROOT.'cache/cache_quickjump_'.$pun_user['g_id'].'.php';
        if (!defined('PUN_QJ_LOADED'))
        {
            require_once PUN_ROOT.'include/cache.php';
            generate_quickjump_cache($pun_user['g_id']);
            require PUN_ROOT.'cache/cache_quickjump_'.$pun_user['g_id'].'.php';
        }
    }

    if ($footer_style == 'viewforum' && $is_admmod)
        echo "\t\t\t".'<p id="modcontrols"><a href="moderate.php?fid='.$forum_id.'&p='.$p.'">'.$lang_common['Moderate forum'].'</a></p>'."\n";
    else if ($footer_style == 'viewtopic' && $is_admmod)
    {
        echo "\t\t\t".'<dl id="modcontrols"><dt><strong>'.$lang_topic['Mod controls'].'</strong></dt><dd><a href="moderate.php?fid='.$forum_id.'&tid='.$id.'&p='.$p.'">'.$lang_common['Delete posts'].'</a></dd>'."\n";
        echo "\t\t\t".'<dd><a href="moderate.php?fid='.$forum_id.'&move_topics='.$id.'">'.$lang_common['Move topic'].'</a></dd>'."\n";

        if ($cur_topic['closed'] == '1')
            echo "\t\t\t".'<dd><a href="moderate.php?fid='.$forum_id.'&open='.$id.'">'.$lang_common['Open topic'].'</a></dd>'."\n";
        else
            echo "\t\t\t".'<dd><a href="moderate.php?fid='.$forum_id.'&close='.$id.'">'.$lang_common['Close topic'].'</a></dd>'."\n";

        if ($cur_topic['sticky'] == '1')
            echo "\t\t\t".'<dd><a href="moderate.php?fid='.$forum_id.'&unstick='.$id.'">'.$lang_common['Unstick topic'].'</a></dd></dl>'."\n";
        else
            echo "\t\t\t".'<dd><a href="moderate.php?fid='.$forum_id.'&stick='.$id.'">'.$lang_common['Stick topic'].'</a></dd></dl>'."\n";
    }

    echo "\t\t\t".'</div>'."\n";
}

?>
            <p class="conr">Powered by <a href="http://punbb.org/">PunBB</a><?php if ($pun_config['o_show_version'] == '1') echo ' '.$pun_config['o_cur_version']; ?><br />© Copyright 2002?2005 Rickard Andersson</p>
<?php

// Display debug info (if enabled/defined)
if (defined('PUN_DEBUG'))
{
    // Calculate script generation time
    list($usec, $sec) = explode(' ', microtime());
    $time_diff = sprintf('%.3f', ((float)$usec + (float)$sec) - $pun_start);
    echo "\t\t\t".'<p class="conr">[ Generated in '.$time_diff.' seconds, '.$db->get_num_queries().' queries executed ]</p>'."\n";
}

?>
            <div class="clearer"></div>
        </div>
    </div>
</div>
<?php


// End the transaction
$db->end_transaction();

// Display executed queries (if enabled)
if (defined('PUN_SHOW_QUERIES'))
    display_saved_queries();

$tpl_temp = trim(ob_get_contents());
$tpl_main = str_replace('pun_footer>', $tpl_temp, $tpl_main);
ob_end_clean();
// END SUBST - <pun_footer>


// START SUBST - <pun_include "*">
while (preg_match('#<pun_include "([^/\\\\]*?)">#', $tpl_main, $cur_include))
{
    if (!file_exists(PUN_ROOT.'include/user/'.$cur_include[1]))
        error('Unable to process user include <pun_include "'.htmlspecialchars($cur_include[1]).'"> from template main.tpl. There is no such file in folder /include/user/');

    ob_start();
    include PUN_ROOT.'include/user/'.$cur_include[1];
    $tpl_temp = ob_get_contents();
    $tpl_main = str_replace($cur_include[0], $tpl_temp, $tpl_main);
    ob_end_clean();
}
// END SUBST - <pun_include "*">


// Close the db connection (and free up any result data)
$db->close();

// Spit out the page
exit($tpl_main);

Since i've already got the screenshot of the footer up i might aswell ask another thing regarding the footer; I'm allowed to change the "Powered by" to something a little more swedish, right? Like "Drivs med" or "[forumname] körs med" or something like that..

2

Re: Unwanted character shows above footer (resolved)

It looks like its being inserted before you get to footer.php. Does it only show up on the index page?. The easiest way to track down things like that is to hit view-source on your browser.

3 (edited by Arvid 2005-08-06 18:22)

Re: Unwanted character shows above footer (resolved)

No, it's inside the topics and on the rules page and everywhere else.

When i highlight the "<" and choose View source i can see the problem (right at the beginning), but i don't know which file this code comes from:

<<div id="brdfooter" class="block">
    <h2><span>Sidfot</span></h2>
    <div class="box">
        <div class="inbox">

            <dl id="searchlinks" class="conl">
                <dt><strong>Söklänkar</strong></dt><dd><a href="search.php?action=show_24h">Visa de senaste inläggen</a></dd>

                <dd><a href="search.php?action=show_unanswered">Visa obesvarade inlägg</a></dd>
            </dl>
            <p class="conr">Powered by <a href="http://punbb.org/">PunBB</a><br>© Copyright 2002?2005 Rickard Andersson</p>
            <div class="clearer"></div>
        </div>
    </div>
</div>

4

Re: Unwanted character shows above footer (resolved)

Check you don't have an extra "<" in main.tpl.

5

Re: Unwanted character shows above footer (resolved)

That's not it either unfortunately.

I really do not want to reinstall because of one little stupid "<", but it looks more and more like that's what i gotta do..

Re: Unwanted character shows above footer (resolved)

did you look though the footer.php file, i dont think you have to reinstall to get rid of it....you just have to find where it it.

7

Re: Unwanted character shows above footer (resolved)

I can see it.

$tpl_main = str_replace('pun_footer>', $tpl_temp, $tpl_main);

Its the 'pun_footer>' bit. It should be '<pun_footer>'.

Whats happening is that the "<" at the start of <pun_footer> in the template is not getting replaced so it is just appearing as a character.

8

Re: Unwanted character shows above footer (resolved)

That's it!!

Thank you very much Paul, it's most appreciated!

Re: Unwanted character shows above footer (resolved)

I have the same problem, but when I try to update footer.php to replace the other '<' it doesn't keep my change, upon saving if I reopen the file it reverts back to how it was.  Any Ideas?

10

Re: Unwanted character shows above footer (resolved)

I don't see how that can happen. Nothing should be writing to footer.php on the server. I assume you are changing footer php by editing it in a text editor on your desktop and then replacing the copy of footer.php on your server?

Re: Unwanted character shows above footer (resolved)

What are you using to edit the file?

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

12 (edited by novasie 2005-10-05 22:37)

Re: Unwanted character shows above footer (resolved)

Hmm i have the same problem it justs changes the footer.php back. Kinda weird, what can write to footer?

EDIT: FINALLY GOT IT WORKING WOHO! wink

13 (edited by downliner 2006-05-04 14:25)

Re: Unwanted character shows above footer (resolved)

I'm having this same problem now but these current suggestions aren't resolving the issue :S

The footers appearance was fine, I changed 'Copyright Rickard Andersson' to say 'Theme based on Nosebleed' and it added that character. All I did was change the text, no code at all.

I got a fresh copy of footer.php and uploaded that - the problem went away. Again though as soon as I changed the text it messed up by adding a < character.

Any ideas?

EDIT: Solved the problem myself by editing the file on the server itself instead of uploading it. Don't know what difference it made and don't care, it works now lol.