atutor.no

Here be links.

Use anchor links in ATutor

Vegard A. Johansen's picture

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!

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

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