diff --git a/code/models/Section.php b/code/models/Section.php index 412e2c8..e1898d3 100644 --- a/code/models/Section.php +++ b/code/models/Section.php @@ -231,7 +231,7 @@ public static function Type($ClassName = NULL){ */ public function Anchor(){ if ($this->MenuTitle && $this->ShowInMenus) { - return strtolower(str_replace(' ','',$this->MenuTitle)); + return strtolower(trim(preg_replace('/[^a-zA-Z0-9]+/', '-',$this->MenuTitle), '-')); } return false; } diff --git a/code/models/SectionsListItem.php b/code/models/SectionsListItem.php index 3251bc9..572e67d 100644 --- a/code/models/SectionsListItem.php +++ b/code/models/SectionsListItem.php @@ -74,7 +74,7 @@ public function getNiceStatus() { public function Anchor(){ if ($this->Title) { - return strtolower(str_replace(' ','',$this->Title)); + return strtolower(trim(preg_replace('/[^a-zA-Z0-9]+/', '-',$this->Title), '-')); } return false; } diff --git a/code/models/SectionsPerson.php b/code/models/SectionsPerson.php index 2d5237a..aebb7c7 100644 --- a/code/models/SectionsPerson.php +++ b/code/models/SectionsPerson.php @@ -122,7 +122,7 @@ public function canCreate($member = null) public function Anchor(){ if ($this->Name) { - return strtolower(str_replace(' ','',$this->Name)); + return strtolower(trim(preg_replace('/[^a-zA-Z0-9]+/', '-',$this->Name), '-')); } return false; }