Recent Topics

How to enable the [a name=""] option. SORTED

Started by on Apr 22, 2008 – Contents updated: Feb 19, 2014

Apr 22, 2008 10:32    

My b2evolution Version: 2.4.1

Is it possible to add to the options on the GUI formmating bar for posts or at least allow the [a name=""] option for a link.

I would like to be able to link to specific parts of an article (Post or page)

Thanks

Apr 22, 2008 16:02

I thought about a plugin for this. The place I get stopped cold is how to make the link to a specific bit inside the post knowing that it has to be an absolute URL else the base href tag will take over and the link will be relative to your skins/yourskin/ folder.

I'm sure it can be done with something like a "regenerate_url_even_though_it_hasnt_been_created_yet()" function but wow that stuff scares me so I go off and do something mindlessly simple ;)

Hey wait a minute adding ONLY the <a name="whatever"> bit shouldn't be hard at all. Possibly just turn off one of the security checker features? Alternatively it could be to hack ... whatever file it is that says what attribute is allowed for which tags (sorry but I don't know where all that stuff moved to lately). The hardship in my mind is having a toolbar that would both make the anchor AND a hyperlink to the anchor. So like you could have an index at the top of the post that skipped to each section within a post.

I shall have to test this and see if I'm even close.

May 26, 2008 01:05

Hi Ed

Have sorted this. I hacked the file inc/xhtml_validator/_xhtml_dtd.inc.php.

Added id and name attributes to the ‘a’ tag

Code

Line 341 'a' => $A_attrs.' charset type href hreflang rel rev shape coords target id name',

NOTES
1. The internal link/bookmark contains both the id and name attributes having the same value
2. The href has to be an absolute url.

I also hacked the quicktags.plugin.php so I have a button to automate the addition of both attributes after entering a value. It's a mod of the href button.

I'll clarify the code for it later.

EDIT 1: For more details and code for the button see http://eu.rogerlovejoy.eu/b2evo.php/enable-alt-a-name-agt

All the best


Form is loading...

powered by b2evolution – This forum is powered by b2evolution CMS, a complete engine for your website.