Thanks for this great article on creating friendly urls.. I made a slightly neater stripurl function so thought I should post it for others.
// used to strip the title of any bad characters so it can be made into page url
function StripUrl($title)
{
$badchars = array( \"#\", \"/\", \"$\", \",\", \":\", \";\", \"=\", \"?\", \"@\", \"<\", \">\", \"%\", \"{\", \"}\", \"|\", \"\\\\\", \"^\", \"~\", \"[\", \"]\", \"`\",\"\'\", \"\\\"\");
$title = str_replace($badchars, \"\", $title);
$title = str_replace(\"&\", \"and\", $title);
$title = str_replace(\"&\", \"and\", $title);
$title = str_replace(\"+\", \"plus\", $title);
$title = str_replace(\" \", \"_\", $title);
return $title;
}
0 Comments