RCB Posted February 19, 2009 Share Posted February 19, 2009 hey guys i have a question.. im creating a external display for my forums shoutbox, im looking to replace a certain part of the return if needed but im unsure how to do it... this is my code so far $ipbwi->DB->allow_sub_select=1; $result = $ipbwi->DB->query(" SELECT * FROM ibf_d22shoutbox_shouts s ORDER BY s_id DESC LIMIT 6 "); while ($r = $ipbwi->DB->fetch_row($result)) { $m = $ipbwi->member->info($r[s_mid]); $g = $ipbwi->group->info($m[g_id]); $date = date("D. jS - g:i a", $r['s_date']); $shouts .= ''.$date.' '.$g['prefix'].$m['members_display_name'].$g['suffix'].' '.$r['s_message'].'<br />'; } if someone posts a emoticon it will come back with <img src="style_emoticons/<#EMO_DIR#>/tongue.gif" alt="tongue.gif" /> what i need is it replace the <#EMO_DIR#> with the actual path.. im not sure how to do this i assume i need to use 'str_ireplace' something like str_ireplace("<#EMO_DIR#>", "images", "<img src='style_emoticons/<#EMO_DIR#>/tongue.gif' alt='tongue.gif' />"); im not sure how to implement it my current code if someone can help that would be great thx cheers RCB Quote Link to comment https://forums.phpfreaks.com/topic/145924-should-i-use-str_ireplace-and-how/ Share on other sites More sharing options...
sasa Posted February 19, 2009 Share Posted February 19, 2009 $shouts .= ''.$date.' '.$g['prefix'].$m['members_display_name'].$g['suffix'].' '.str_replace("<#EMO_DIR#>", "images", $r['s_message']).'<br />'; Quote Link to comment https://forums.phpfreaks.com/topic/145924-should-i-use-str_ireplace-and-how/#findComment-766096 Share on other sites More sharing options...
RCB Posted February 19, 2009 Author Share Posted February 19, 2009 $shouts .= ''.$date.' '.$g['prefix'].$m['members_display_name'].$g['suffix'].' '.str_replace("<#EMO_DIR#>", "images", $r['s_message']).'<br />'; thanks! worked great Quote Link to comment https://forums.phpfreaks.com/topic/145924-should-i-use-str_ireplace-and-how/#findComment-766107 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.