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.

Customising the CMS /

Metadata URL field


Reply


3 Posts   547 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!!! :-)