$file=str_replace("{title2}",$line['title'],$file); $file['title2'] = trim(preg_replace('/[^\w\d]+/', ' ', $file['title2'])); $file['title2'] = str_replace(' ', '-', $file['title2']); PHP: The first line does what it should do, have {title2} in the template generate the page title. The next two lines don't do the replacing.
You mean with all of that .htaccess stuff you've been posting, you can't whip yourself a solution out of that?
//replace the {title2} placeholder with the actual title... $file = str_replace("{title2}", $line['title'], $file); //replace anything which is not a 'word' character (a-z,0-9,_) with a - (dash) $file['title2'] = preg_replace('#[^\w]+#', '-', $file['title2']); //note: the # delimiter does'nt change any functionality (personal preference) PHP: You don't need the \d within the second line as \w includes that...furthermore the third line is unneccesary as you can simply replace the second line with the - (dash)...instead of adding an extra line of code. ----- That should clear things up for you...if your still getting problems reply with what $file['title2'] contains (by echo'ing it) alongside what would need to be replaced (with what..if anything)