PDA

View Full Version : Replacement variables NOT case sensitive


Jawelin
12-11-2001, 12:56 PM
Hi. I found probably a bug in the replacement variable feature of VB 2.2.1 (and below, I guess).
You can find more information here (https://vborg.vbsupport.ru/showthread.php?s=&threadid=33121) in vb.org ...

Well, with a little studying, I found out the actual replacement code is in functions.php, here:
while ($var=$DB_site->fetch_array($vars)) {
if ($var['findword']!="") {
$newtext=str_replace($var['findword'],$var['replaceword'],$newtext);
}
}

My question is: your own opinion, could I generate any side effect replaceing the above line with the following one ?

$newtext=str_replace(strtoupper($var['findword']),$var['replaceword'],strtoupper($newtext));

I.e., this way, the $newtext variable is assigned from the strtoupper($newtext) or - hopefully - all the findword occurrences are replaced into the original $newtext, which remains the same ?

:confused: :confused:

Thank you for any help.
Bye

Mark Hensler
12-11-2001, 02:47 PM
No... your $newtext will be in all caps.

for case insensitive, try this:

$newtext = eregi_replace($var['findword'], $var['replaceword'], $newtext);
eregi_replace() will put a higher load on your system than a simple str_replace.

PHP Docs: eregi_replace() (http://www.php.net/manual/en/function.eregi-replace.php)

Jawelin
12-12-2001, 01:56 PM
:(

No. I can't add load to cpu, already too high ...
(I'm on shared server... always about 4-7 % avg...)

A workaround: that function runs at displaying time; if I made something like at editing/insert time (even with eregi_replace()) ??
How many and where should I modify (add) the function ?

Thnx a lot.
Bye