View Single Post
Old 02-21-2013, 07:13 PM   PM User | #1
DJ Hands3
New Coder

 
Join Date: Feb 2009
Posts: 90
Thanks: 5
Thanked 0 Times in 0 Posts
DJ Hands3 is an unknown quantity at this point
str_replace problem

Hi,

I am trying to modify a code in my blog to replace a part of the text so it will insert a poll

The original blog code works like this:

PHP Code:
$message str_replace(":!:""<img src=\"images/smilies/icon_exclaim.gif\" alt=\"\"></img>"$message); 
I have tried to modify, but have only got this far:

PHP Code:

// Insert Polls

$message str_replace("[poll1]""<iframe width=\"100%\" src=\"blog-poll.php?pollid=$id\" scrolling=\"no\" id=\"the_iframe\" onLoad=\"calcHeight();\" height=\"1px\" frameborder=\"0\" ></iframe>"$message); 
where [poll1] should be found within $message so it will change the text to show the poll and the $id should be the number of the poll e.g. 1 if I type [poll1]

I have found suitable regex "/^(.*\[poll)(.*)(\])/" but not sure how to implement this?
DJ Hands3 is offline   Reply With Quote