Fixed unique URL segment generation when there is a number in the segment - http://www.silverstripe.com/contributions/flat/3528

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@39629 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew O'Neil 2007-08-06 21:36:01 +00:00
parent bf8357f2ef
commit f69d610293

View File

@ -462,7 +462,7 @@ class SiteTree extends DataObject {
$count = 1;
while(DataObject::get_one("SiteTree", "URLSegment = '$this->URLSegment' $idFilter")) {
$count++;
$this->URLSegment = ereg_replace('-[0-9]+','', $this->URLSegment) . "-$count";
$this->URLSegment = ereg_replace('-[0-9]+$','', $this->URLSegment) . "-$count";
}
// If the URLSegment has been changed, rewrite links