string-in-url
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
function maakUrlTitel($string) {
$string = strtolower($string);
$lettervan = "áéóúíäëöüïàèòùìýÿå";
$letternaar = "aeouiaeouiaeouiyya";
$string = strtr($string, $lettervan, $letternaar);
$string = str_replace(" ", "-", $string);
$sTekens = preg_replace("_([a-z0-9-])_", "", $string);
for($i=0;$i<=strlen($sTekens);$i++) {
$string = str_replace(substr($sTekens, $i, 1), "", $string);
}
while(substr($string, 0, 1) == '-')
$string = substr($string, 1, strlen($string)-1);
while(substr($string, strlen($string)-1, 1) == '-')
$string = substr($string, 0, strlen($string)-1);
return $string;
}
?>
function maakUrlTitel($string) {
$string = strtolower($string);
$lettervan = "áéóúíäëöüïàèòùìýÿå";
$letternaar = "aeouiaeouiaeouiyya";
$string = strtr($string, $lettervan, $letternaar);
$string = str_replace(" ", "-", $string);
$sTekens = preg_replace("_([a-z0-9-])_", "", $string);
for($i=0;$i<=strlen($sTekens);$i++) {
$string = str_replace(substr($sTekens, $i, 1), "", $string);
}
while(substr($string, 0, 1) == '-')
$string = substr($string, 1, strlen($string)-1);
while(substr($string, strlen($string)-1, 1) == '-')
$string = substr($string, 0, strlen($string)-1);
return $string;
}
?>