PDA

View Full Version : [Fixed] One extra line break for [php] codes in certain browsers



Gary King
Sun 25th May '03, 4:45pm
Browser: Mozilla Firebird 0.6

Problem: For some reason, when I view code in [php] tags, the code has one extra line break - code in [ code ] tags do not have this problem, though.

Example:


if ($bbuserinfo['userid']!=0)
{
print "Your <b>userid</b> is $bbuserinfo['userid']."
}
else
{
print "You are not logged in, please log in!."
}

would show up as:


if ($bbuserinfo['userid']!=0)

{

print "Your <b>userid</b> is $bbuserinfo['userid']."

}

else

{

print "You are not logged in, please log in!."

}

when they are enclosed in [php] tags instead.

Would be nice to have this fixed, so I don't always to remove the extra lines (although it isn't very difficult using PHP).

Bane
Sun 25th May '03, 11:40pm
if ($bbuserinfo['userid']!=0)
{
print "Your <b>userid</b> is $bbuserinfo['userid']."
}
else
{
print "You are not logged in, please log in!."
}

Bane
Sun 25th May '03, 11:41pm
Working correctly in Mozilla 1.4b on Windows XP.

Floris
Sun 25th May '03, 11:43pm
On vB3 yes, on vB230, no.

1.3b on vb230f shows as in attachment:

Gary King
Sun 25th May '03, 11:50pm
On vB3 yes, on vB230, no.

1.3b on vb230f shows as in attachment:
Also, if you have noticed, the <hr>'s do not show up properly. This isn't really a big issue (for me, anyways); this [php] code problem is the most important for me, at the moment.

Floris
Mon 26th May '03, 12:16am
Replace: <pre> with <source> and </pre> with </source> and it should show up properly in both browsers

Line: return "</normalfont><blockquote><pre><smallfont>PHP:</smallfont><hr>$buffer<hr></pre></blockquote><normalfont>";

File: admin/functions.php

Gary King
Mon 26th May '03, 12:23am
Replace: <pre> with <source> and </pre> with </source> and it should show up properly in both browsers

Line: return "</normalfont><blockquote><pre><smallfont>PHP:</smallfont><hr>$buffer<hr></pre></blockquote><normalfont>";

File: admin/functions.php
Works perfectly - even fixes the <hr>'s.

Floris
Mon 26th May '03, 12:37am
Hence, this is not the solution, but merely a temporary fix that makes a compromise between IE/Mozilla to show up as 99% supposed.

Stadler
Mon 26th May '03, 5:05am
I've replaced
return "</normalfont><blockquote><pre><smallfont>PHP:</smallfont><hr>$buffer<hr></pre></blockquote><normalfont>";
with
return "</normalfont><blockquote><code style=\"white-space: nowrap\"><smallfont>PHP:</smallfont><hr size=\"1\">$buffer<hr size=\"1\"></code></blockquote><normalfont>";and it seems to work perfectly, since I've used the HTML-source of this page in order to find out, what needs to be changed :)

In other words:

REPLACE <pre> WITH <code style=\\"white-space: nowrap\\">

REPLACE </pre> WITH </code>

REPLACE <hr> WITH <hr size=\\"1\\">

Chen
Mon 26th May '03, 5:20am
Using <code> is probably better as I don't think <source> is part of XHTML.

Scott MacVicar
Sun 8th Jun '03, 9:14pm
using <code> since <source> doesn't appear to be valid HTML.