Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

erm... don't know how i can fix this :¦

Status
Not open for further replies.

jamesp0tter

Programmer
Joined
Feb 20, 2003
Messages
119
Location
PT
well, i have a .php page that transforms a string into something more usefull (forum like) like:

$str = "ehehehhe :p";
$finalstr = &quot;ehehehhe <img src=\&quot;p.gif\&quot;>&quot;;

well, then i have the & [url] tags, that allow to put images and links. now imagine a pic has the name &quot;something:p.gif&quot;.. that'll mess the whole thing up :\\i would come out with an output like
<img src=&quot;something<img src=&quot;p.gif&quot;>.gif&quot;>

how can i go around this ?... :(

i use the following code:
$msg = preg_replace(&quot;'\[img](.*?)\[/img\]'si&quot;, &quot;<img src=\&quot; $msg);
$msg = preg_replace(&quot;'\[url\](.*?)\[/url\]'si&quot;, &quot;<a href=\&quot; target=\&quot;blank\&quot;>\$1</a>&quot;, $msg);

$msg = preg_replace(&quot;':P'si&quot;,&quot;<img width=15 height=15 border=0 src=\&quot;images/smilies/P.gif\&quot;>&quot;, $msg);

if you need anything else to help solve the problem, i'll be happy to post it

tkx in advance !
 
hmm.. i was thinking in some way to see if it's inside a <img> tag and replace if not, but that'll do it :)

tks !
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top