vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   How to replace text in content - Please help (https://vborg.vbsupport.ru/showthread.php?t=294213)

achoo254 01-22-2013 03:01 AM

How to replace text in content - Please help
 
Hi,

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

You may post new threads

You may post replies

You may post attachments

You may edit your posts

like this:
Code:

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

Quote:

Originally Posted by Amaury25 (Post 2398553)
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

Quote:

Originally Posted by achoo254 (Post 2398557)
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

Quote:

Originally Posted by Amaury25 (Post 2398558)
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:
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:
Quote:

<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 [DATE]1359091756[/DATE] at [TIME]1359091756[/TIME] ---------------

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


All times are GMT. The time now is 03:55 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01116 seconds
  • Memory Usage 1,731KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete