vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Replace certain words by vB code "on the fly"? (https://vborg.vbsupport.ru/showthread.php?t=43994)

Areku 09-27-2002 12:24 PM

Replace certain words by vB code "on the fly"?
 
Does this hack exist?

So if for example I type a post and include certain word in plain text, it will be replaced by vbcode?

Say for example:

"Hello this is an example of how Microsoft sux"

and when hitting SEND, Microsoft is replaced by a link to microsoft.com or similar stuff...

Logician 09-28-2002 11:31 AM

easy way: create a new vbcode with that word and its replacement..

Xenon 09-28-2002 11:40 AM

sorry pal, but this isn't possible anymore.
this way you mentioned was possible in vb1.x

other methods:
you can create a replacement-code with that word and it's replacement:
advantage: fast way
disadvantage: when someone edits the post the replacement is also parsed and becomes html code in edit box

or you can edit admin/functions.php
find:
PHP Code:

function bbcodeparse2($bbcode,$dohtml,$dobbimagecode,$dosmilies,$dobbcode)
// parses text for vB code, smilies and censoring

  
global $DB_site,$wordwrap,$allowdynimg$bbuserinfo;

  static 
$smilies,$bbcodes;
  global 
$regexcreated,$searcharray,$replacearray,$phpversionnum;

  if(
$wordwrap!=0) {
    
$bbcode=dowordwrap($bbcode);
  } 

below add:
PHP Code:

  $bbcode=str_replace("microsoft","[url]http://www.microsoft.com[/url]",$bbcode); 

carefull: the code is casesensitiv

Areku 10-01-2002 09:29 AM

Thank you for your answers!

As for the second method, can I add more than just 1 replacement?

Xenon 10-01-2002 09:35 AM

you can create as much replacements as you like

WotC_Mel 03-30-2004 07:53 PM

Well, I am coming in late to the party. Is there any reason not to add abut 50 replacement lines? As in, will it cause performance issues?

Also, will this work for phrases?

-Melanie

Xenon 03-30-2004 09:49 PM

you'd better ask this general vb question at vbulletin.com

as replacements are using php functions to replace texts in strings, of course every replacement will make the parsing slower, but normally you won't notice this, as it's nothing regarding other things ;)


All times are GMT. The time now is 01:10 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.00958 seconds
  • Memory Usage 1,722KB
  • 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
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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