Welcome Guest, Not a member yet? Register   Sign In
anchor() unable to parse double quotes
#1

[eluser]Armchair Samurai[/eluser]
Pretty minor, but has come up a few times in the forum, mostly from people wanting to use the anchor() fuction with an image.

The anchor() function is unable to parse double quotes in the text parameter, causing corrupted HTML output, unless the third parameter is present to prevent the default rendering of the title attribute.

Example:
Code:
<?=anchor('path/goes/here', '"foo"');?>

/* Outputs an messy link */
<a href="http://docroot/path/goes/here" title=""foo"">"foo"</a>

One solution would be to parse the $attributes variable on line 111:
Code:
/* in the URL helper */
$attributes = str_replace('"', '&quot;', $title);

/* if you call the code from the first example,
it will parse everything correctly, outputting: */
<a href="http://docroot/path/goes/here" title="&quot;foo&quot;">"foo"</a>


Messages In This Thread
anchor() unable to parse double quotes - by El Forum - 10-16-2007, 11:48 PM



Theme © iAndrew 2016 - Forum software by © MyBB