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, Ed, biapar, Willr, Ingo, swaiba

Disable hash link rewriting for a particular instance

Go to End

4 Posts   2064 Views

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?


Community Member, 473 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.


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 :).

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.