Jump to content

Links in TextAreas


Gazley
 Share

Recommended Posts

Hi there,

I want to link to pages in the site from within TextAreas (eg: Body copy type fields). In code, I might output a link using a $page->url value.

I've seen the PageLinkAbstractor module and whilst I superficially understand what its use-case is, it doesn't seem to be for exactly what I'm trying to achieve.

I think I am wondering how I can simulate getting the results of a page find() into a link without having to manually type the href value into the HTML. If it's a manual process and that's how it's done, then so be it. However, if there is a best practice around this, I would be keen to understand how others link to site based pages from within site-copy text areas.

Thanks!

  • Like 1
Link to comment
Share on other sites

With regard to your original suggestion, does the link's href get resolved at run-time or by selecting the target page in TinyMCE, does it just literally embed the path as a string so, no dynamic find() call at runtime?

Link to comment
Share on other sites

Anything in TinyMCE text is pretty much raw HTML, so I've tried not to introduce any other factors into that in order to ensure the portability of the content. However, the PageLinkAbstractor module (soon to be replaced by LinkMonitor) does convert them to/from page ID references, so that links don't get broken when you move a site to another subdir or move an individual page. The disadvantage of PageLinkAbstractor/LinkMonitor is that because the link data is then abstracted, your content is no longer portable. If you ever uninstall the module, any links it has abstracted will then be broken. There's also a small amount of overhead associated with converting links to/from abstractions on the fly, but I think it's a worthwhile compromise for most.

You might also want to look at the PagePathHistory module (included with the PW core). This keeps track of page moves and maintains redirects when a page is accessed at an old URL.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...