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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Customising the CMS /

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

Metadata URL field


Go to End


3 Posts   1269 Views

Avatar
lucasoftnet

Community Member, 2 Posts

29 February 2012 at 10:41pm

Hi,

I need to maintain some URL of an old web site version. Those urls are like:

http://www.pincopalla.it/articoli-bar/barmats_floormats/service_barmat/333

however in Metadata-> URL filed of CMS if I try to add the char "_" it is replaced by "-"
How can disable this behaviour?

I'm using Silverstripe on Windows with IIS 6 and IIRF as url rewriting module...

Can someone help me?
Thanks

Avatar
mishell

Community Member, 19 Posts

1 March 2012 at 12:31am

The behavior is made on SiteTree::onBeforeWrite on line 1355, by ereg_replace. Maybe if You write on Your Page.php

 

	protected function onBeforeWrite() {
		parent::onBeforeWrite();
                            if($this->isChanged('URLSegment')) {
//Your replace here
}
              } 

Hope it helps

Avatar
lucasoftnet

Community Member, 2 Posts

2 March 2012 at 10:39am

this is perfect!
Many Thaks!!! :-)