BBCODE +OFFTOPIC Funktion? Brauche etwas Hilfe!

Fragen zu allen Themen rund ums Programmieren außerhalb von phpBB können hier gestellt werden - auch zu anderen Programmiersprachen oder Software wie Webservern und Editoren.
Benutzeravatar
Blutgerinsel
Mitglied
Beiträge: 1801
Registriert: 19.07.2004 18:53
Wohnort: Landkreis Ulm
Kontaktdaten:

Beitrag von Blutgerinsel »

Wollte schon immer mal einen Offtopic Button integrieren, daher habe ich mir diesen Mod mal angeschaut und für nicht gut genug befunden :D
Nachfolgend das Ergebnis dieser Kleinigkeit....

Den Mod finde ich nicht astrein weil u.A. die BBCODE UID nicht berrücksichtigt wird.....

Daher würde ich eine Einheit schaffen.......Auch Offtopic zu schreiben wäre mir viel zu lang weil ot sagt schon alles aus.....

Code: Alles auswählen

OPEN includes/bbcode.php

FINDE
// [b ] and [/b ] for bolding text.
	$text = str_replace("[b:$uid]", $bbcode_tpl['b_open'], $text);
	$text = str_replace("[/b:$uid]", $bbcode_tpl['b_close'], $text);

ADD,AFTER
// [ot ] and [/ot ] for offtopic text.
	$text = str_replace("[ot:$uid]", $bbcode_tpl['ot_open'], $text);
	$text = str_replace("[/ot:$uid]", $bbcode_tpl['ot_close'], $text);

FINDE
// [b ] and [/b ] for bolding text.
	$text = preg_replace("#\[b\](.*?)\[/b\]#si", "[b:$uid]\\1[/b:$uid]", $text);

ADD,AFTER
// [ot] and [/ot] for offtopic text.
	$text = preg_replace("#\[ot\](.*?)\[/ot\]#si", "[ot:$uid]\\1[/ot:$uid]", $text);


FINDE
// [QUOTE] and [/QUOTE] for posting replies with quote, or just for quoting stuff.
	$text = str_replace("[quote:$uid]", $bbcode_tpl['quote_open'], $text);
	$text = str_replace("[/quote:$uid]", $bbcode_tpl['quote_close'], $text);
Bei

ADD,AFTER
// [OFFTOPIC] and [/OFFTOPIC] for posting replies with quote, or just for quoting stuff.
	$text = str_replace("[ot:$uid]", $bbcode_tpl['ot_open'], $text);
	$text = str_replace("[/ot:$uid]", $bbcode_tpl['ot_close'], $text);


OPEN /template/yourtemplate/bbcode.tpl

würde ich das ganze auch in Richtung Zitat formatieren und zwar so

FIND
// [QUOTE ] and [/QUOTE ] for posting replies with quote, or just for quoting stuff.
$text = str_replace("[quote:$uid]", $bbcode_tpl['quote_open'], $text);
$text = str_replace("[/quote:$uid]", $bbcode_tpl['quote_close'], $text);

ADD,AFTER
<!-- BEGIN ot_open --></span>
<table width="90%" cellspacing="1" cellpadding="3" border="0" align="center">
<tr> 
	  <td><span class="genmed"><b>Offtopic:</b></span></td>
	</tr>
	<tr>
	  <td class="quote"><!-- END ot_open -->
<!-- BEGIN ot_close --></td>
	</tr>
</table>
<span class="postbody"><!-- END ot_close -->

OPEN /templates/subsilver/posting_body.tpl

FIND
f_help = "{L_BBCODE_F_HELP}";

AFTER,ADD
ot_help = "{L_BBCODE_OT_HELP}";

FIND
bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','
','
  • ','
','
  • ','
','[img]','[/img]','','');

INLINE FIND
'[/url]'

AFTER,ADD
,'[ot]','[/ot]'

FIND
<td><span class="genmed">
<input type="button" class="button" accesskey="q" name="addbbcode6" value="Quote" style="width: 50px" onClick="bbstyle(6)" onMouseOver="helpline('q')" />
</span></td>

AFTER,ADD
<td><span class="genmed">
<input type="button" class="button" name="addbbcode18" value="Offtopic" style="width: 50px" onClick="bbstyle(18)" onMouseOver="helpline('ot')" />
</span></td>

FIND
<select name="addbbcode18" onChange="bbfontstyle('[color=' + this.form.addbbcode18.options[this.form.addbbcode18.selectedIndex].value + ']', '[/color]');this.selectedIndex=0;" onMouseOver="helpline('s')">

Replace with
<select name="addbbcode20" onChange="bbfontstyle('[color=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/color]');this.selectedIndex=0;" onMouseOver="helpline('s')">

FIND
</select> &nbsp;{L_FONT_SIZE}:<select name="addbbcode20" onChange="bbfontstyle('[size=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/size]')" onMouseOver="helpline('f')">

Replace With
</select> &nbsp;{L_FONT_SIZE}:<select name="addbbcode22" onChange="bbfontstyle('[size=' + this.form.addbbcode22.options[this.form.addbbcode22.selectedIndex].value + ']', '[/size]')" onMouseOver="helpline('f')">

OPEN
/posting.php

FIND
'L_BBCODE_F_HELP' => $lang['bbcode_f_help'],

AFTER,ADD
'L_BBCODE_OT_HELP' => $lang['bbcode_ot_help'],

OPEN
/language/lang_main.php

FIND
$lang['bbcode_f_help'] = 'Schriftgröße: [size=x-small]Kleiner Text[/size]';

AFTER,ADD
$lang['bbcode_ot_help'] = 'Offtopic: [ot]Ich bin eine dumme Bemerkung[/ot]';
[/code]
Antworten

Zurück zu „Coding & Technik“