PDA

View Full Version : How to replace text in content - Please help


achoo254
01-22-2013, 03:01 AM
Hi,

i'm want to replace text or add tag <span> in content, ex:

You may post new threads

You may post replies

You may post attachments

You may edit your posts


like this:

You <span>may post new threads</span>

You <span>may post replies</span>

You <span>may post attachments</span>

You <span>may edit your posts</span>


Please help me, thanks!

Amaury
01-22-2013, 03:42 AM
You can probably take care of that in the Phrase Manager.

achoo254
01-22-2013, 03:49 AM
You can probably take care of that in the Phrase Manager.

No, i'm mean content in postbit ====> post['message']

Amaury
01-22-2013, 03:56 AM
No, i'm mean content in postbit ====> post['message']

Please provide a screenshot showing what you want and a link to your forum.

achoo254
01-22-2013, 04:26 AM
Please provide a screenshot showing what you want and a link to your forum.

Please help me post #9

Thanks!

achoo254
01-23-2013, 01:20 PM
anyone helps me? :(

mokujin
01-23-2013, 01:26 PM
Đến lắm quảng cáo nhìn đau cả mắt.

Lynne
01-23-2013, 04:35 PM
Please post in English. Thank you.

achoo254
01-24-2013, 12:11 PM
I've done outside tags, but i don't know using random tags, here my code:

$content = "<span style="color:black;">hello word</span>, this is my <span style="color:black;">code!</span>...and nice to meet everyone!";
$find = array('#>([^<>]+)<([^/]{1,1})#');
$replace = array(
'><span style="color:red;">$1</span><$2',
'><span style="color:blue;">$1</span><$2',
'><span style="color:white;">$1</span><$2');
$content = preg_replace($find, $replace, $content);

Result:

<span style="color:black;">hello word</span><span style="color:red;">, this is my </span><span style="color:black;">code!</span><span style="color:red;">...and nice to meet everyone!</span>


So how to fix it , please help ! :(

--------------- Added 1359091756 at 1359091756 ---------------

i tried preg_replace to preg_replace_callback but don't work , please anyone help me! :(