|
Posted by Steve on 04/25/07 13:39
"ana" <anka@vizualmedia.hr> wrote in message
news:f0n5jp$er$1@ss408.t-com.hr...
| I'm not very good programer, I use one php script for cms for flash.
| When I make changes in text in this CMS, for example I put letters bold,
| this script puts <strong></strong> on beginning and the end, but I need
| <b></b> so I use str_replace to replace strong with b, and this is ok.
flash doesn't recognize <strong> ?!
| But when I change a color, this script puts for example <font
color=#CCCCCC>
| in front of letters but I need <font color="#CCCCCC"> because Flash won't
| read it without quotes. And I can't say str_replace #CCCCCC with "#CCCCCC"
| because I don't know wich color the person will choose.
doesn't matter. use pre_replace. this would be similar to the pattern you'd
use (though i'm not testing it):
/<[^\s]\s+([^=\s]=([^"'\s))*?>/g
the second, inner parenthetical is the value not quoted. you'd replace $2
with '"' . $2 . '"'. this would put quotes around ever attribute in your
html that did not have quotes...and not just for the font tags...everything.
hth,
me
[Back to original message]
|