Recently, I wanted to add one of those accessiblity top menu bar on a MODx website I am building... I was faced with the need to set anchor links in my documents. I wanted only one chunk for the whole website and since anchor links are relative, I needed a way to generate the right path dynamically.
Edit : Fixed according to Wendy’s tip below.
Here is what I did : I use [~[*id*]~]#anchor
Of course you’ll have to check your URL settings there : it will work with friendly URLs:Yes, Use friendly aliases:Yes, Use friendly alias path:Yes
Sample chunk
<ul>
<li><a href="[~[*id*]~]#content" title="Directly access content">Go to content |</a></li>
<li><a href="[~[*id*]~]#menu" title="Directly access menu">Go to menu |</a></li>
<li><a href="[~[*id*]~]accessiblity/" title="Accessibility policy">Accessiblity policy</a></li>
</ul>
Hope you find this useful
.: COO - Commerce Guys - Community Driven Innovation :.
MODx est l'outil id
hi !
but in my website this tip does not work with alias paths ..
for example,
the link will link to website.com/alias.html instead of website.com/pathtoalias/alias.html
( i used [(base_url)][*alias*] in the templates )
p.s. i had added this tag in the pages header <base href="[(site_url)]" /> ( the dropmenu alias paths doesn’t work if i don’t )
i’m not a native english speaker, sorry if there are any mistakes !
Pikkitux.com Website about Ubuntu Linux, Website Creation, and many other how-tos, tips and tricks ... ( French Language, and of course Modx Powered ! )
Dumb me, I only tested this with a document at the root, not in subfolder...
Wendy, not sure the [~[*id*]~] trick will do : I had asked
here about that, and Jason said I’d have to use the id trick, but
it didn’t cut it for me and I still have to find the right way to do it...
Anyone ?
.: COO - Commerce Guys - Community Driven Innovation :.
MODx est l'outil id
Hmmm, I’ll check that but I believe I have proper URL settings and I didn’t get the path with [~[*id*]~], only the file alias which I agree is strange.
I probably missed something specific to my config or did something wrong then. I’ll check and report.
Thanks !
.: COO - Commerce Guys - Community Driven Innovation :.
MODx est l'outil id
I have just tested the [~[*id*]~] trick, and... it works !
[~[*id*]~]#anchor gives me the right link, with the right subfolder path.
Many thanks to you.
R
Ok thanks Wendy for the correction to my tip !
I have to check this now, since I am the culprit for it not working... grrr
.: COO - Commerce Guys - Community Driven Innovation :.
MODx est l'outil id