PDA

View Full Version : getting strange results with the BB code parser


RossOliver
09-17-2005, 08:17 PM
Hey,

I've altered my includes/functions_bbcodeparser.php file to add an image after every hyperlink (as the mediaWiki software does for external links; see my wiki (http://www.developersdigest.org) );


if ($type == 'url')
{
// standard URL hyperlink
return "<a href=\"$rightlink\" target=\"_blank\">$text</a> <img src=\"./images/misc/ext_link.png\">";
}
else
{
// email hyperlink (mailto:)
if (is_valid_email($rightlink))
{
return "<a href=\"mailto:$rightlink\">$text</a> <img src=\"./images/misc/ext_link.png\">";
}
else
{
// not a valid email - don't link it
return "<span title=\"$rightlink\">$text</span>";
}
}



The problem is it seems to be converting the <img src=""> tags into https://vborg.vbsupport.ru/ bb code tags somewhere and I'm struggling to find where. Basically; if you add a link to your post, then preview it, it will add the https://vborg.vbsupport.ru/ tags into your post. If you press preview again it will add another set - one for every time you preview/submit the post.

Any ideas where it's doing this?

Thanks for your time,

-Ross

Andreas
09-17-2005, 08:25 PM
Try


if (!$wysiwygparse)
{
$imgadd = ' <img src="./images/misc/ext_link.png">';
}

if ($type == 'url')
{
// standard URL hyperlink
return "<a href=\"$rightlink\" target=\"_blank\">$text</a>$imgadd";
}
else
{
// email hyperlink (mailto:)
if (is_valid_email($rightlink))
{
return "<a href=\"mailto:$rightlink\">$text</a>$imgadd";
}
else
{
// not a valid email - don't link it
return "<span title=\"$rightlink\">$text</span>";
}
}

RossOliver
09-17-2005, 08:30 PM
That worked perfectly - thanks!

Out of curiosity...what on earth does 'wysiwygparse' stand for when it's at home?

-Ross

Andreas
09-17-2005, 08:37 PM
$wysiwygparse true means parsing is being done to generate input for the WYSIWYG-Editor.
But as you don't want the image to be edited, it must not be shown then.

RossOliver
09-17-2005, 08:46 PM
oooh so wysiwyg is the name of the editor - makes sense now :)

Thanks again,

-Ross