Anchors for Dummeez

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
bilbothecat
Forum Members
Forum Members
Posts: 13
Joined: Mon Mar 31, 2008 9:21 am

Anchors for Dummeez

Post by bilbothecat »

I have had trouble with anchors in CMSMS and despite the large number of helpful posts on the subject (many offering overly complex solutions) I sat down and tackled the problem thoroughly.

So I went back to basics and produced this tutorial for me which I can share with those that are in need and who use Pretty URLs on their site.

IN PAGE ANCHORS

Normally in html we would identify our target position with

Code: Select all

<a name="LINK_TO_HERE"></a>
.

Then we would create the link to the target position with

Code: Select all

<a href="#LINK_TO_HERE">FROM HERE</a> 
.

LINK TO ANCHORS IN OTHER PAGES

Again normally in html we would create the link to the target position with

Code: Select all

<a href="/targetpage.php#LINK_TO_HERE">FROM HERE</a>
(assumes root relative path).

Well if you want to use the html method in CMSMS you have to use the path to the page in both cases. So the html would look like

Code: Select all

<a href="index.php/targetpage#LINK_TO_HERE">FROM HERE</a>
. (Assume targetpage is your page alias) and use this for both IN PAGE links to anchors and LINK TO ANCHORS IN OTHER PAGES.

If you do not want to go down the html route and you use TinyMCE you can use the Make Anchor Tool to create the LINK_TO_HERE anchor and if you wish use the Anchor Tag

Code: Select all

{anchor anchor="LINK_TO_HERE" text="FROM HERE"}
. But this will only work for IN PAGE anchors.

To link to anchors in other pages in CMSMS you have 2 other options once you have used the Make Anchor Tool to create the LINK_TO_HERE anchor:

1. Create your link using the CMSMS link maker in TinyMCE then edit the html to put

Code: Select all

#LINK_TO_HERE
at the end of the created link e.g.

Code: Select all

<a href="index.php?page=targetpage#LINK_TO_HERE">FROM HERE</a>
.

2. Create your link using the link maker entering the URL as

Code: Select all

index.php/targetpage#LINK_TO_HERE
but ignore the field asking for an anchor.

For whatever reason the

Code: Select all

{anchor}
tag does not appear to create links to anchors on other pages.

The only drawback with all this as far as I can see is if you have editors without html knowledge that want to place anchors in the pages they update and link to these.

For these situations I guess you would have to provide a short tutorial using the make anchor tool in TinyMCE and the method at 2. above, as these require no html editing.

Hope this helps someone as much as it has helped me.
Last edited by bilbothecat on Wed Feb 18, 2009 11:28 am, edited 1 time in total.
Post Reply

Return to “CMSMS Core”