Elxis CMS Forum

Support => Technical support => Topic started by: apkoutsou on August 25, 2010, 16:06:25

Title: Internal links with <a href=#top>
Post by: apkoutsou on August 25, 2010, 16:06:25
I have created a menu module that it is displayed only when specific content items are shown.

The menu has internal links like #link1 that point to specific names of <p> indiside the item text.

As the menu module is displayed for more then one item (that have the same link name e.g. #link1), the menu-item links are like #link1, #link2 et.c. (without the whole url). But when the menu is displayed the links are turned into [sitename]#link1 and not [sitename]/[section]/[category]/[item title].html as normally expected...

On the other hand this problem does not appear for internal links created inside the content item text, which are turned into urls as expected!

Do you know why is this happening and how to make it work? Otherway I have to make different menus (and menu modules) for every content item for which the same menu sould be displayed...
Title: Re: Internal links with <a href=#top>
Post by: datahell on August 25, 2010, 20:27:17
Anchor links syntax is as follows.
<a name="test">Test area</a>
<a href="http://www.mysite.com/section/category/item.html#test">go to test</a>

You can alternative use javascript to scroll to a specific location of the page by using the ID attribute in the destination elements instead of anchors.
Title: Re: Internal links with <a href=#top>
Post by: apkoutsou on August 25, 2010, 22:20:14
I use a javascript to create a smooth scrolling effect, which uses anchors to scroll between destinations. My point is that inside item's maintext I reate ancors like

Code: [Select]
<a href="#dest">Go to Destonation</a>
that are automatically turned into

Code: [Select]
<a href="http://www.mysite.com/section/category/item.html#dest">Go to Destonation</a>
I looked into com_content code, but I couldn't find any relevant code, which changes anchors (As I can guess this is not done by the editor, as when I edit the text it remaines as the first line above. So how is it being changed on the fly?

But, nonetheless, when you create an anchor with only the "#dest", browser should understand what it ment and translated it correctly. That's why I run same tests and noticed that this happens only when basic or advanced SEO is enabled; so when the url is rewritten, the browser sees only the site name, that's why I got the

Code: [Select]
<a href="http://www.mysite.com/#dest">Go to Destonation</a>
So, is there a way to do what I want easily? Or should I recreate the current url to succeed my goal?