Jump to:

23456 Posts in 18905 Topics by 2877 members

General Questions

SilverStripe Forums » General Questions » Disable hash link rewriting for a particular instance

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Page: 1
Go to End
Author Topic: 1455 Views
  • Ryan M.
    Avatar
    Community Member
    309 Posts

    Disable hash link rewriting for a particular instance Link to this post

    I want to have hash link rewriting enabled for the entire site, but disabled for only one instance in a template because the rewriting is interfering with the function of a jQuery script associated with a few items on that page. Any ideas on how to accomplish this?

  • simon_w
    Avatar
    Forum Moderator
    471 Posts

    Re: Disable hash link rewriting for a particular instance Link to this post

    I've noticed that using single quotes, rather than double quotes, for the href attribute prevents the rewriting from occurring.

  • hydrogennz
    Avatar
    Community Member
    2 Posts

    Re: Disable hash link rewriting for a particular instance Link to this post

    I can confirm this works and is a nice easy fix .

  • Ryan M.
    Avatar
    Community Member
    309 Posts

    Re: Disable hash link rewriting for a particular instance Link to this post

    Thanks for the tip!

    I got around it temporarily by doing this:

    public function CSPopLink() {
          $filename = $this->Logo()->Filename;
          $name = substr($filename, 0, strrpos($filename, '.'));
          return "#pop-".$name;
       }

    When you return a link through the controller, it doesn't get the hash rewrite applied. It only happens in the template.

    1455 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.