Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

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

Disable hash link rewriting for a particular instance


Reply


4 Posts   1511 Views

Avatar
Ryan M.

Community Member, 309 Posts

19 January 2011 at 4:47pm

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?

Avatar
simon_w

Forum Moderator, 474 Posts

19 January 2011 at 6:49pm

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

Avatar
hydrogennz

Community Member, 2 Posts

23 February 2011 at 1:33pm

Edited: 23/02/2011 1:33pm

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

Avatar
Ryan M.

Community Member, 309 Posts

23 February 2011 at 4:41pm

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.