How to do inline links not hardcoded?

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
Jesse
Forum Members
Forum Members
Posts: 29
Joined: Fri Jan 07, 2011 8:56 pm

How to do inline links not hardcoded?

Post by Jesse »

Here is what I'm trying to do:
Within the content of the page (not the menu), I want to have a link to another page that exists in my site/cms.
I know of two approaches:
1. hardcode the url, which would mean that the link would break if the url is changed by changes I may make in the cms in the future.
2. make it a one item menu, which allows the link to still be correct if the url of the page is changed via the cms.

The second is closer to the result I want, but seems like extra work, and I am wondering if there is some capability in cmsms that I am not aware of for adding a non-hardcoded inline link in the content.

Also if I am doing a one item menu, what would be the recommended syntax?
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: How to do inline links not hardcoded?

Post by jmcgin51 »

I think what you're looking for is simply the cms selflink function, available by default in the core. i.e.

{cms_selflink page='home' text='Click this to go to the homepage'}

you can also specify a pageid instead of an alias
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: How to do inline links not hardcoded?

Post by Dr.CSS »

If you are trying to link to another page using a word in the content, highlight the word and hit the second palm tree, has a chain link on it, that is the self link to cmsms pages...
Jesse
Forum Members
Forum Members
Posts: 29
Joined: Fri Jan 07, 2011 8:56 pm

Re: How to do inline links not hardcoded?

Post by Jesse »

Thank you, I think the answer I was looking for was the first one.
{cms_selflink page='home' text='Click this to go to the homepage'}
keeps the link functional if I move the target to be under a different parent page for instance.
Im not sure if I understand the distinction between page id and alias, however.

The second solution "palm tree with chain link" gives me the hardcoded link which would then be broken if the target url changes at all.
jmcgin51
Power Poster
Power Poster
Posts: 1899
Joined: Mon Jun 12, 2006 9:02 pm

Re: How to do inline links not hardcoded?

Post by jmcgin51 »

actually both methods create cms_selflinks. Your system may be set up to create <a href> style links instead of cms_selflink style links. You can change the style you want in the TinyMCE preferences.
Post Reply

Return to “CMSMS Core”