Help w/anchors...hope this is where I'm supposed to be!

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
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Help w/anchors...hope this is where I'm supposed to be!

Post by Dr.CSS »

I see the the anchor, <a href="#Daniel">, but not sure where it's supposed to go...
zap12345
Forum Members
Forum Members
Posts: 20
Joined: Thu Nov 19, 2009 8:04 am

Re: Help w/anchors...hope this is where I'm supposed to be!

Post by zap12345 »

Hi there,

I've just had exactly the same problem with inserting a link to an anchor and having this redirect me to the home page! In googling around plus looking at your website, I can see that you've found one solution (well done! :) ) and I've also come across another couple of solutions that I thought that you may be interested in too...?

Basically it seems that the problem is that when the link to the anchor is inserted using the "insert/edit link" icon in the menu, the link doesn't include a reference to the webpage that the anchor is on. So one solution is to simply add this reference to the link. There are a couple of ways to do this:

a) After adding the link using the "insert/edit link" icon, go to the HTML (e.g. by clicking the "HTML" button in the menu), and type in the reference to the webpage the anchor is on. To add in the reference, you can either:

(i) Type in the exact name of the webpage that the anchor is on - as you've done - e.g: <a href="index.php?page=sermons#Daniel">The Sovereign Majesty of God - A Study in the Book of Daniel</a>

(ii) Type in {$page_alias} - this is a useful wee shortcut which allows CMSMS to determine which page you're on, thus meaning that you don't need to work out the exact page yourself. For example: <a href="{$page_alias}#Daniel">The Sovereign Majesty of God - A Study in the Book of Daniel</a>

Or the general case: <a href="{$page_alias}#anchor1">Link to Anchor 1</a>

I've found this to be a very useful hint - thanks very much to spcherub for this hint, which is given halfway down the discussion about anchors and links on: http://forum.cmsmadesimple.org/viewtopic.php?t=52967

(b) An alternative way to add the reference to the webpage is to type it in using the menu when you are adding the link. If you aren't familiar with HTML, this could be a better option?

To do this, after you have completed your steps 7 and 8 from above:

7) Click on the "insert/edit link" icon in the menu
8) Choose the name of your link from the anchor dropdown box

you will see, in the "Link URL" box in the menu, the name of your anchor e.g. #Daniel . In front of these words, type {$page_alias} so giving {$page_alias}#Daniel . Click "Insert" and continue with the remainder of your steps above, and the link to the anchor should now work as it should :)

c) Please don't post or link to code that will modify any core files, read the forum rules...

Anyway, hopefully this may be helpful to both you and possibly others? Also, well done on your website - I'm most impressed that a 63 year old grandma is developing a website! :) Very very cool!! :)

Warm regards,
Zaneta
Post Reply

Return to “CMSMS Core”