Hab die BBCode ein wenig umgeschrieben.
Dazu sind einige Äderungen von Nöten.
/include/includes/func/bbcode.php
function bbcode_simple ($s) {
$page = preg_quote(dirname(str_replace('www.','',$_SERVER["HTTP_HOST"]).$_SERVER["SCRIPT_NAME"]), '/');
$search = array (
"/[b](.*?)[/b]/si",
"/[i](.*?)[/i]/si",
"/[u](.*?)[/u]/si",
"/[s](.*?)[/s]/si",
"/[center](.*?)[/center]/si",
"/[color=rot](.*?)[/color]/si",
"/[color=gelb](.*?)[/color]/si",
"/[color=gruen](.*?)[/color]/si",
"/[color=blau](.*?)[/color]/si",
"/[url=http://(www.)?(".$page.")(.*?)](.*?)[/url]/si",
"/[url=http://(www.)?(.*?)](.*?)[/url]/si",
"/[*]([^[]*)/is",
"/[list](.+)[/list]/Usi",
"/[list=1](.+)[/list]/Usi",
"/(script|about|applet|activex|chrome):/is",
);
$replace = array (
"<b>1</b>",
"<i>1</i>",
"<u>1</u>",
"<s>1</s>",
"<center>1</center>",
"<span style='color:Red'>1</span>",
"<span style='color:Yellow'>1</span>",
"<span style='color:Green'>1</span>",
"<span style='color:Blue'>1</span>",
"<a href="http://123">4</a>",
"<a href="http://12" target="_blank">3</a>",
"<li>1</li>",
"<ul>1</ul>",
"<ol>1</ol>",
"1:",
);
$s = preg_replace($search, $replace, $s);
return ($s);
}
/include/includes/js/bbcode.js
var tagOpen = '[';
var tagClos = ']';
var tagEnde = '/';
var colorOpen = 'color=';
var colorClose = 'color';
var tagUrl1 = '[url=';
var tagUrl2 = ']';
var tagUrl3 = '[/url]';
function simple(name) {
var help = name;
if(help =='rot' || help =='gruen' || help =='blau' || help =='gelb')
{
aTag = tagOpen + colorOpen+ name + tagClos;
eTag = tagOpen + tagEnde + colorClose + tagClos;
simple_insert ( aTag, eTag );
}
else
{
aTag = tagOpen + name+ tagClos;
eTag = tagOpen + tagEnde + name + tagClos;
simple_insert ( aTag, eTag );
}
}
Für die HTML Templates bei BBCode dann folgendes verwenden:
<!-- BB Code START -->
<a href="javascript:simple('b')"><img src="include/images/icons/buttons/bold.png" alt="b" title="{_lang_bold}" border="0"></a>
<a href="javascript:simple('i')"><img src="include/images/icons/buttons/italic.png" alt="i" title="{_lang_italic}" border="0"></a>
<a href="javascript:simple('u')"><img src="include/images/icons/buttons/under.png" alt="u" title="{_lang_underlined}" border="0"></a>
<a href="javascript:simple('s')"><img src="include/images/icons/buttons/strike.png" alt="s" title="Durchgestrichen" border="0"></a>
<a href="javascript:simple('center')"><img src="include/images/icons/buttons/center.png" alt="z" title="Zentriert" border="0"></a>
<a href="javascript:simple('rot')"><img src="include/images/icons/buttons/red.png" alt="Rot" title="Rot" border="0"></a>
<a href="javascript:simple('gruen')"><img src="include/images/icons/buttons/green.png" alt="Gruen" title="Gruen" border="0"></a>
<a href="javascript:simple('blau')"><img src="include/images/icons/buttons/blue.png" alt="Blau" title="Blau" border="0"></a>
<a href="javascript:simple('gelb')"><img src="include/images/icons/buttons/yellow.png" alt="Gelb" title="Gelb" border="0"></a>
<a href="javascript:simple('quote')"><img src="include/images/icons/buttons/quote.png" alt="Zitat" title="Zitat" border="0"></a>
<a href="javascript:simple('img')"><img src="include/images/icons/buttons/img.png" alt="{_lang_picture}" title="{_lang_picture}" border="0"></a>
<a href="javascript:simple('url')"><img src="include/images/icons/buttons/link.png" alt="Url" title="{_lang_link}" border="0"></a>
<!-- BB Code ENDE -->
Sich dann noch Buttos zurechtbasteln und in den jeweiligen Ordner kopieren.
Das ganze schaut dann so aus:
externer Link
PS: Die Änderungen sind nur die wesentlichen Auszüge. Der Rest des Codes muss unverändert bestehen bleiben.
Zuletzt modifiziert von Miraculixx am 23.05.2006 - 17:17:01