PDA

View Full Version : Search Freindly URLs suggestion


tfw2005
11-12-2007, 02:24 PM
Currently, when you have a dash in the title of your category, the result shows 3 dashes in a row.

Example:

Fried Chicken - Potatoes = /fried-chicken---potatoes-211/

would like it:

Fried Chicken - Potatoes = /fried-chicken-potatoes-211/

Is there any way to alter the conditionals to remove multiple consecutive dashes, and other non-alphanumeric characters?

Brian
11-13-2007, 11:28 AM
I don't think we'll be adding this to the default code since it would add another str_replace() function to the URL's, but you could look in your includes/vba_dyna_functions.php file for this code:
return str_replace(' ', '-', preg_replace("/[^a-z_0-9 -]/i", '', strtolower(html_entity_decode($text)))) . '-' . $id;

And replace with this:
return str_replace('--', '', str_replace(' ', '-', preg_replace("/[^a-z_0-9 -]/i", '', strtolower(html_entity_decode($text))))) . '-' . $id;