Jump to:

10928 Posts in 2612 Topics by 1809 members

All other Modules

SilverStripe Forums » All other Modules » Anchor links in newsletters

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1233 Views
  • Phill
    Avatar
    Community Member
    75 Posts

    Anchor links in newsletters Link to this post

    Hi

    Im creating a newsletter through the newsletter module which contains links to anchor points in the email.

    Because SS converts the anchor links into absolute urls (#my-anchor becomes www.mysite.com/#my-anchor) the anchor links no longer work.

    I also had to add a <base tag to make images entered through the newsletter module visible in the email preview which may be causing part of the problem.

    I've worked out a possible hack of adding an id to the table containing the links to the anchors, which would then make it possible to use simplexml to parse the content and convert the absolute urls back to relative urls. Does anyone have a better idea of how to achieve this result as i don't really want to edit the core newsletter module files.

    Thanks
    Phil

  • _Vince
    Avatar
    Community Member
    158 Posts

    Re: Anchor links in newsletters Link to this post

    *bump*

    Any ideas..?

  • mi3ll
    Avatar
    Community Member
    23 Posts

    Re: Anchor links in newsletters Link to this post

    I'm not sure if this will work, but try putting this in your mysite/_config.php file

    SSViewer::setOption('rewriteHashlinks', false);

    This will stop silverstripe from rewriting ALL hash links in your site.

  • _Vince
    Avatar
    Community Member
    158 Posts

    Re: Anchor links in newsletters Link to this post

    No... that's not QUITE it. The links now point to

    http://www.mysite.com#whatever-the-anchor-was-called

    as opposed to

    http://www.mysite.com/newsletter/sendNewsletter#whatever-the-anchor-was-called

    but it's still not pointing to the newsletter itself.

    Thanks a heap for the suggestion though!

    1233 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.