View Single Post
  #6  
Old 10-04-2002, 04:56 PM
  minorgod's Avatar 
minorgod minorgod is offline
 

X-Adept
  
Join Date: Sep 2002
Location: Arivaca, AZ
Posts: 402
 

Default I FOUND it!

After over 8 hours of testing various combinations of regular expression syntax, I have managed to get the following to work for changing the URL parameter syntax in a link to use slashes instead of standard URL parameter syntax.....

Code:
$source = preg_replace("/(a href=)(\")([^?]+)([^\"]+)(\")/e", "'$1$3'.str_replace(array('&','?','+','='),'/','$4')", "$source");

Hope this saves someone 8 hours. It turns out that the main stumbling block was the use of the /e flag at the end of the preg pattern. Without that little "e" after the pattern, PHP wouldn't execute the substring search on the 4th substring that contained the parameters needing slash replacement. Now it does. Now on with the search-engine friendly cart mod!
__________________
www.brettbrewer.com
Getting back into x-cart dev after a long hiatus. Modded lots of x-carts from version 3.1.x to 4.1.x. Developer of ImageScaler mod, Pre-login per user coupon mod, Wordpress feed mod, DigitalSubscriptions mod, Phonetic bulk download keys addon for DownloadExpander mod, Serial Number Generator for ESD products, Custom CMS/LMS integrations, external products mod, and more.
Reply With Quote