Hello!
I made these days a script that introduces bb-codes!
I will explain in a few steps how you can install.
1. First creates a file named bbcode.php and add the following to him:
Save the file and exit.
2. Now open the file include.inc.php and add after all code written in the file the following line:
Save the file and exit.
Now start editing files of the design. ( /htdocs/templates/ )
3. Open game_ally_in_ally_overview.tpl
At line 38 find:
Replace with:
At line 54 find:
Replace with:
Save the file and exit.
4. Open game_ally_in_ally_properties.tpl
At line 27 find:
Replace with:
At line 43 find:
Replace with:
Save the file and exit.
5. Open game_info_ally.tpl
At line 28 find:
Replace with:
Save the file and exit.
6. Open game_info_player.tpl
At line 54 find:
Replace with:
Save the file and exit.
7. Open game_mail_arch.tpl
At line 57 find:
Replace with:
Save the file and exit.
8. Open game_mail_in.tpl
At line 57 find:
Replace with:
Save the file and exit.
9. Open game_mail_new.tpl
At line 4 find:
Replace with:
Save the file and exit.
10. Open game_mail_out.tpl
At line 57 find:
Replace with:
Save the file and exit.
This is pretty ... more I leave you to discover!
BB-Codes which are active:
PS: I tried and I made this script for the version DsLan v1.1 , I do know if it works on DsLan v1.12!
I made these days a script that introduces bb-codes!
I will explain in a few steps how you can install.
1. First creates a file named bbcode.php and add the following to him:
Code:
<?php
function bb_player($var) {
$var1=str_replace(' ','+',$var);
$r1 = mysql_query("SELECT * FROM users WHERE username='$var1[1]'");
$n1 = mysql_num_rows($r1);
if($n1=="1") {
if(isset($_GET['village'])) { $villageid='village='.$_GET['village'].'&'; } else { $villageid=""; }
$result = mysql_query("SELECT * FROM users WHERE username='$var1[1]'");
while($row = mysql_fetch_array($result))
{
$echo='<a href="game.php?'.$villageid.'screen=info_player&id='.$row['id'].'">'.str_replace('+',' ',$row['username']).'</a>';
return $echo;
}
} else {
return $var1[1];
}
}
function bb_ally($var) {
$var1=str_replace(' ','+',$var);
$r1 = mysql_query("SELECT * FROM ally WHERE short='$var1[1]'");
$n1 = mysql_num_rows($r1);
if($n1=="1") {
if(isset($_GET['village'])) { $villageid='village='.$_GET['village'].'&'; } else { $villageid=""; }
$result = mysql_query("SELECT * FROM ally WHERE short='$var1[1]'");
while($row = mysql_fetch_array($result))
{
$echo='<a href="game.php?'.$villageid.'screen=info_ally&id='.$row['id'].'">'.str_replace('+',' ',$row['short']).'</a>';
return $echo;
}
} else {
return $var1[1];
}
}
function bb_village($var)
{
$r1 = mysql_query("SELECT * FROM villages WHERE x='$var[1]' AND y='$var[2]'");
$n1 = mysql_num_rows($r1);
if($n1=="1") {
if(isset($_GET['village'])) { $villageid='village='.$_GET['village'].'&'; } else { $villageid=""; }
$result = mysql_query("SELECT * FROM villages WHERE x='$var[1]' AND y='$var[2]'");
while($row = mysql_fetch_array($result))
{
$echo='<a href="game.php?'.$villageid.'screen=info_village&id='.$row['id'].'">'.str_replace('+',' ',$row['name']).'</a>';
return $echo;
}
} else {
$echo="(Sat nevalabil)";
return $echo;
}
}
function bb_format($test) {
$str=$test;
$simple_search = array(
'/\[b\](.*?)\[\/b\]/is',
'/\[i\](.*?)\[\/i\]/is',
'/\[u\](.*?)\[\/u\]/is',
'/\[url\=(.*?)\](.*?)\[\/url\]/is',
'/\[url\](.*?)\[\/url\]/is',
'/\[align\=(left|center|right)\](.*?)\[\/align\]/is',
'/\[img\](.*?)\[\/img\]/is',
'/\[font\=(.*?)\](.*?)\[\/font\]/is',
'/\[size\=(.*?)\](.*?)\[\/size\]/is',
'/\[color\=(.*?)\](.*?)\[\/color\]/is',
);
$simple_replace = array(
'<strong>$1</strong>',
'<em>$1</em>',
'<u>$1</u>',
'<a href="$1" rel="nofollow" title="$2 - $1">$2</a>',
'<a href="$1" rel="nofollow" title="$1">$1</a>',
'<div style="text-align: $1;">$2</div>',
'<img src="$1" alt="" />',
'<span style="font-family: $1;">$2</span>',
'<span style="font-size: $1;">$2</span>',
'<span style="color: $1;">$2</span>',
);
$aa = array(
'/\[player\](.*?)\[\/player\]/is',
);
$bb = array(
'/\[ally\](.*?)\[\/ally\]/is',
);
$cc = array(
'/\[village\](.*?)\|(.*?)\[\/village\]/is',
);
$a=preg_replace_callback($aa, "bb_player", $str);
$b=preg_replace_callback($bb, "bb_ally", $a);
$c=preg_replace_callback($cc, "bb_village", $b);
$d=preg_replace($simple_search, $simple_replace, $c);
return $d;
}
?>
Save the file and exit.
2. Now open the file include.inc.php and add after all code written in the file the following line:
Code:
<?php include('bbcode.php'); ?>
Now start editing files of the design. ( /htdocs/templates/ )
3. Open game_ally_in_ally_overview.tpl
At line 38 find:
Code:
{$ally.intern_text}
Code:
{php} echo bb_format($this->_tpl_vars['ally']['intern_text']); {/php}
At line 54 find:
Code:
{$ally.intern_text}
Code:
{php} echo bb_format($this->_tpl_vars['ally']['intern_text']); {/php}
Save the file and exit.
4. Open game_ally_in_ally_properties.tpl
At line 27 find:
Code:
{$ally.description}
Code:
{php} echo bb_format($this->_tpl_vars['ally']['description']); {/php}
At line 43 find:
Code:
{$ally.description}
Code:
{php} echo bb_format($this->_tpl_vars['ally']['description']); {/php}
Save the file and exit.
5. Open game_info_ally.tpl
At line 28 find:
Code:
{$info.description}
Code:
{php} echo bb_format($this->_tpl_vars['info']['description']); {/php}
Save the file and exit.
6. Open game_info_player.tpl
At line 54 find:
Code:
{$info_user.personal_text}
Code:
{php} echo bb_format($this->_tpl_vars['info_user']['personal_text']); {/php}
Save the file and exit.
7. Open game_mail_arch.tpl
At line 57 find:
Code:
{$mail.text}
Code:
{php} echo bb_format($this->_tpl_vars['mail']['text']); {/php}
Save the file and exit.
8. Open game_mail_in.tpl
At line 57 find:
Code:
{$mail.text}
Code:
{php} echo bb_format($this->_tpl_vars['mail']['text']); {/php}
Save the file and exit.
9. Open game_mail_new.tpl
At line 4 find:
Code:
{$preview_message}
Code:
{php} echo bb_format($this->_tpl_vars['preview_message']); {/php}
Save the file and exit.
10. Open game_mail_out.tpl
At line 57 find:
Code:
{$mail.text}
Code:
{php} echo bb_format($this->_tpl_vars['mail']['text']); {/php}
Save the file and exit.
This is pretty ... more I leave you to discover!
BB-Codes which are active:
- [ player][/player] ( ex: [ player]Tavicu[/player] )
- [ ally][/ally] ( ex: [ ally]TA[/ally] )
- [ village][/village] ( ex: [ village]252|253[/village] )
- [ b][/b] ( ex: [ b]Text Bold[/b] )
- [ i][/i] ( ex: [ i]Text italic[/i] )
- [ u][/u] ( ex: [ u]Text underline[/u] )
- [ url][/url] ( ex: [ url]http://dslan.gfx-dose.de[/url] )
- [ url=][/url] ( ex: [ url=http://dslan.gfx-dose.de]DS-Lan[/url] )
- [ align=][/align] ( ex: [ align=center]Text[/align] )
- [ img][/img] ( ex: [ img]http://dslan.gfx-dose.de/test.png[/img] )
- [ font=][/font] ( ex: [ font=Arial]Font test[/font] )
- [ size=][/size] ( ex: [ size=20]Big font[/size] )
- [ color=][/color] ( ex: [ color=#6B8E23]Font color[/color] )
PS: I tried and I made this script for the version DsLan v1.1 , I do know if it works on DsLan v1.12!