Author Topic: bbcode  (Read 13275 times)

0 Members and 1 Guest are viewing this topic.

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile
bbcode
« on: December 14, 2010, 11:06:13 PM »
Hello this Code dont work for me:
	
$text preg_replace("/\[shadow\][color=#(.*?)\](.*?)\[\/color\][\/shadow\]/si""<span style=\"text-shadow: 2px 2px 5px #\\1;\">\\2</span>"$text);
	
$text preg_replace("/\[color=#(.*?)\][shadow\](.*?)[\/shadow\]\[\/color\]/si""<span style=\"text-shadow: 2px 2px 5px #\\1;\">\\2</span>"$text);

Error:
Quote
Warning: preg_replace() [function.preg-replace]: Compilation failed: missing terminating ] for character class at offset 52 in /www/htdocs/w00b2576/testumgebung/4images/bbcodev3/bbcodev3.php on line 357

Warning: preg_replace() [function.preg-replace]: Compilation failed: missing terminating ] for character class at offset 52 in /www/htdocs/w00b2576/testumgebung/4images/bbcodev3/bbcodev3.php on line 358
I cantīt find the error!

Offline Jan-Lukas

  • Addicted member
  • ******
  • Posts: 1.289
    • View Profile
    • Discover the New World of Kindersurprise
Re: bbcode
« Reply #1 on: December 15, 2010, 12:47:31 AM »
statt " dieses ' im Netz wird das so angeboten
$text preg_replace('/\

z.B

$text preg_replace('/\[color=([[:alnum:]]{6}?).*\](.*?)\[\/color\]/''<font color="#$1">$2</font>'$text);

Danke Harald




Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile
Re: bbcode
« Reply #2 on: December 15, 2010, 05:25:31 PM »
Danke dir.
Das habe ich allerdings auch schon versucht.
Das Problem ist das ich zwei Bbcode Varianten auf einmal umwandeln will.
Ich werde das aber noch etwas austesten!

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: bbcode
« Reply #3 on: December 15, 2010, 05:33:03 PM »
$text preg_replace("/\[shadow\]\[color=#[a-z0-9]+\](.*)\[\/color\]\[\/shadow\]/si""<span style=\"text-shadow: 2px 2px 5px #\\1;\">\\2</span>"$text);
$text preg_replace("/\[color=#[a-z0-9]+\]\[shadow\](.*)\[\/shadow\]\[\/color\]/si""<span style=\"text-shadow: 2px 2px 5px #\\1;\">\\2</span>"$text);
« Last Edit: December 15, 2010, 05:56:16 PM by V@no »
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile
Re: bbcode
« Reply #4 on: December 15, 2010, 05:46:03 PM »
Thank you Vano,
but the errors are still there!

Quote
Warning: preg_replace() [function.preg-replace]: Compilation failed: missing terminating ] for character class at offset 51 in /www/htdocs/w00b2576/testumgebung/4images/bbcodev3/bbcodev3.php on line 357

Warning: preg_replace() [function.preg-replace]: Compilation failed: missing terminating ] for character class at offset 51 in /www/htdocs/w00b2576/testumgebung/4images/bbcodev3/bbcodev3.php on line 358

Warning: preg_replace() [function.preg-replace]: Compilation failed: missing terminating ] for character class at offset 53 in /www/htdocs/w00b2576/testumgebung/4images/bbcodev3/bbcodev3.php on line 377

Warning: preg_replace() [function.preg-replace]: Compilation failed: missing terminating ] for character class at offset 53 in /www/htdocs/w00b2576/testumgebung/4images/bbcodev3/bbcodev3.php on line 378

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: bbcode
« Reply #5 on: December 15, 2010, 05:56:45 PM »
updated above
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile
Re: bbcode
« Reply #6 on: December 15, 2010, 06:09:20 PM »
Also does not help.
I have now tried many things, but it does not work.
However, it was previously shown more mistakes and now only two errors displayed.

Quote
Warning: preg_replace() [function.preg-replace]: Compilation failed: missing terminating ] for character class at offset 51 in /www/htdocs/w00b2576/testumgebung/4images/bbcodev3/bbcodev3.php on line 357

Warning: preg_replace() [function.preg-replace]: Compilation failed: missing terminating ] for character class at offset 51 in /www/htdocs/w00b2576/testumgebung/4images/bbcodev3/bbcodev3.php on line 358

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: bbcode
« Reply #7 on: December 15, 2010, 06:36:20 PM »
are you sure on lines 357 and 358 my code? I doubt it.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile
Re: bbcode
« Reply #8 on: December 15, 2010, 07:08:36 PM »
You were right.
The Bbcode now causes no errors, but my idea did not succeed.
Look at the screenshot.

The color code from Color Bbcode supposed to be used for the shadow.

<span style=\"text-shadow: 2px 2px 5px #COLOR-CODE-FROM-COLOR-BBCODE\">TEXT</span>

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: bbcode
« Reply #9 on: December 15, 2010, 07:12:39 PM »
looks like you need move these lines above all other preg_replace..so they would be replaced first, then the rest of your bbcode

the sequence at witch your text is being replace does matter ;)
« Last Edit: December 15, 2010, 07:25:16 PM by V@no »
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.805
  • I ♥ 4I
    • View Profile
Re: bbcode
« Reply #10 on: December 15, 2010, 07:46:32 PM »
I've already done. But then nothing displays.
That's all pretty complex!