atutor.no

Here be links.

anchors

Vegard A. Johansen's picture

Use anchor links in ATutor

Breaking a very long silence on this blog with a little tweak we did today.

Thing is, you are not able to use anchor links in ATutor content pages. That is links to content on the same page defined like this.

<a name="top"></a>

..lots of text..

<a href="#top">Go to top</a>

This will create a bug where you are asked to download an empty document. To fix it you need the full path to the page, which you luckily can do with the handy [cid] token which will always return the full path to the page you're at. So, this will work:

<a name="top"></a>

..lots of text..

<a href="[cid]#top">Go to top</a>

That only leaves one problem, and that is how to get the visual editor to account for this. I poked around in the code a bit today, and here is how you solve it.

In a text editor, open the /atutor/jscripts/tiny_mce/plugins/advlink/js/advlink.js file.

Line 373 will read as follows:

<?php

html
+= '<option value="#' + name + '">' + name + '</option>';
?>

(ignore php tags)

Simply change this to:

<?php

html
+= '<option value="[cid]#' + name + '">' + name + '</option>';
?>

..and you are good to go!

Hi, this is the atutor.no blog, where the community can blog about things related to use, development or thoughts concerning the open source LCMS ATutor!

Register or log in to start blogging, or get in touch for any reason!

Recent comments