| « Feedback form XHTML Warning | Sort Message Position » |
Enable <a name=" "> tag
25th May 23:21 SORTED
It has taken me many hours to find the right file to hack, its inc/xhtml_validator/_xhtml_dtd.inc.php version v 1.3 2008/02/08 22:24:46
Added id and name attributes to the 'a' tag
Line 341 'a' => $A_attrs.' charset type href hreflang rel rev shape coords target id name',
NOTES
1. The internal link/bookmark should contain both the id and name attributes having the same value
2. The href has to be an absolute url.
26th May 00:08 Updated post on forum
Is it possible to enable the [a name=""] option.
Have also hacked the quicktags plugin by adding a button to automate the id and name attributes.
To do this I added three bits of code.
1. First I added a new button. I copied the section for the href link, and replaced the words 'link and href' with 'name' in three places and provided a new Hot Key option of Alt-N.
b2evoButtons[b2evoButtons.length] = new b2evoButton(
'b2evo_name',
'name',
'text-decoration:underline;',
'',
'</a>',
'a',
'<?php echo T_('A name [Alt-N]') ?>'
); // special case
2. Then added another elseif statement, by copying the href elseif and changing two instances of the word 'link' to 'name'
else if( button.id == 'b2evo_name' )
{
document.write('<input type="button" id="' + button.id + '" accesskey="' + button.access + '" title="' + button.tit
+ '" style="' + button.style + '" class="quicktags" onclick="b2evoInsertName(b2evoCanvas, ' + i + ');" value="' + button.display + '" />');
}
3. Finally I copied the function b2evoInsertLink().
The name was altered to b2evoInsertName, the default value has been removed, although I haven't as yet removed the code for it, and lastly the start tag was altered to automate the addition of an id and name attribute rather than the 'href'
function b2evoInsertName(myField, i, defaultValue)
{
if (!defaultValue)
{
defaultValue = '';
}
if (!b2evoCheckOpenTags(i))
{
var URL = prompt( ':', defaultValue);
if (URL)
{
b2evoButtons[i].tagStart =
'<a id="' + URL + '" name="' + URL + '">';
b2evoInsertTag(myField, i);
}
}
else
{
b2evoInsertTag( myField, i );
}
}
