PDA

View Full Version : preg_replace() when search includes the "/" character


Webnower
03-29-2008, 02:06 PM
I'm having a slight problem with the search feature...

It works fine for searching words like "loose" or "dimension", but if my search query includes the "/" character, it throws me this error at the top of the screen:
Warning: preg_replace() [function.preg-replace]: Unknown modifier '1' in [path]/includes/vba_dyna_functions.php on line 238

Warning: preg_replace() [function.preg-replace]: Unknown modifier '1' in [path]/includes/vba_dyna_functions.php on line 238

I'm using a multiple instance version of Dynamics and I have SEO links turned on. The only templates I have modified are the ADV_DYNA, entrybit_expanded, categorybit_level1 and ADV_SHOWENTRY.

The exact word I'm searching is "9/11".

I also get this error on my main (first) installation of Dynamics where I don't have any modified templates except ADV_DYNA.

Brian
03-31-2008, 01:29 PM
Thank you for pointing this out. If you will look in your forum/includes/vba_dyna_functions.php file for this line:
$string = preg_replace("/($word)([^>]*<)/i", "<span class=\"highlight\">$1</span>$2", $string);

And add this just Above it:
$word = str_replace('/', '\\/', $word);

Then that should take care of the issue.

Our Sponsors
 

Webnower
03-31-2008, 05:33 PM
Awesome :) I'll try it out as soon as I get home from work. Thanks!