Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
<script src="editor.js" type="text/javascript" ></script>
<?
function bbcode($text){
$text=preg_replace("/\[b\](.+?)\[\/b\]/s", '<b>$1</b>',$text);
$text=preg_replace("/\[i\](.+?)\[\/i\]/s", '<i>$1</i>',$text);
$text=preg_replace("/\[u\](.+?)\[\/u\]/s", '<u>$1</u>',$text);
$text=preg_replace("/\[quote\](.+?)\[\/quote\]/s", '<table cellspacing="1" width="100%" border="0"><tr><td>Quote:</td></tr><tr><td width="100%" style="border:solid 1px black">$1</td></tr></table>',$text);
$text=preg_replace("/\[quote\=(.+?)](.+?)\[\/quote\]/s", '<table cellspacing="1" width="100%" border="0"><tr><td>$1 каза:</td></tr><tr><td width="100%" style="border:solid 1px black">$2</td></tr></table>',$text);
$text=preg_replace("/\[url\](.+?)\[\/url\]/s", '<a href="$1">$1</a>',$text);
$text=preg_replace("/\[url\=(.+?)\](.+?)\[\/url\]/s", '<a href="$1">$2</a>',$text);
$text=preg_replace("/\[img\](.+?)\[\/img\]/s", '<img src="$1" alt="User submitted image" title="User submitted image"/>',$text);
$text=preg_replace("/\[color\=(.+?)\](.+?)\[\/color\]/s", '<span style="color:$1">$2</span>',$text);
$text=preg_replace("/\[size\=(.+?)\](.+?)\[\/size\]/s", '<span style="font-size:$1">$2</span>',$text);
$text=preg_replace("/\[code\](.+?)\[\/code\]/s",'<table cellspacing="1" width="100%" border="0"><tr><td>Code:</td></tr><tr><td width="100%" style="border:solid 1px black">$1</td></tr></table>',$text);
$text = nl2br($text);
return $text;
}
$htmlcode = $_POST['post'];
if (!$htmlcode){
?>
<input type="button" class="button" value="bold" name="bold" onclick="javascript:tag('b', '[b]', 'bold*', '[/b]', 'bold', 'bold');" onMouseOver="helpline('bold')" />
<input type="button" class="button" value="italic" name="italic" onclick="javascript:tag('i', '[i]', 'italic*', '[/i]', 'italic', 'italic');" onMouseOver="helpline('italic')" />
<input type="button" class="button" value="underline" name="underline" onclick="javascript:tag('u', '[u]', 'underline*', '[/u]', 'underline', 'underline');" onMouseOver="helpline('underline')" />
<input type="button" class="button" value="quote" name="quote" onclick="javascript:tag('q', '[quote]', 'quote*', '[/quote]', 'quote', 'quote');" onMouseOver="helpline('quote')" />
<input type="button" class="button" value="code" name="code" onclick="javascript:tag('c', '[code]', 'code*', '
свалих гиcrazy_pi4 каза:Ми незнам.. там има архив с файловете свали ги и пробвай
<script src="editor.js" type="text/javascript" ></script>
<?
function bbcode($text){
$text=preg_replace("/\[b\](.+?)\[\/b\]/s", '<b>$1</b>',$text);
$text=preg_replace("/\[i\](.+?)\[\/i\]/s", '<i>$1</i>',$text);
$text=preg_replace("/\[u\](.+?)\[\/u\]/s", '<u>$1</u>',$text);
$text=preg_replace("/\[quote\](.+?)\[\/quote\]/s", '<table cellspacing="1" width="100%" border="0"><tr><td>Quote:</td></tr><tr><td width="100%" style="border:solid 1px black">$1</td></tr></table>',$text);
$text=preg_replace("/\[quote\=(.+?)](.+?)\[\/quote\]/s", '<table cellspacing="1" width="100%" border="0"><tr><td>$1 каза:</td></tr><tr><td width="100%" style="border:solid 1px black">$2</td></tr></table>',$text);
$text=preg_replace("/\[url\](.+?)\[\/url\]/s", '<a href="$1">$1</a>',$text);
$text=preg_replace("/\[url\=(.+?)\](.+?)\[\/url\]/s", '<a href="$1">$2</a>',$text);
$text=preg_replace("/\[img\](.+?)\[\/img\]/s", '<img src="$1" alt="User submitted image" title="User submitted image"/>',$text);
$text=preg_replace("/\[color\=(.+?)\](.+?)\[\/color\]/s", '<span style="color:$1">$2</span>',$text);
$text=preg_replace("/\[size\=(.+?)\](.+?)\[\/size\]/s", '<span style="font-size:$1">$2</span>',$text);
$text=preg_replace("/\[code\](.+?)\[\/code\]/s",'<table cellspacing="1" width="100%" border="0"><tr><td>Code:</td></tr><tr><td width="100%" style="border:solid 1px black">$1</td></tr></table>',$text);
$text = nl2br($text);
return $text;
}
$htmlcode = $_POST['post'];
if (!$htmlcode){
?>
<form action="write.php" method="post" name="editform" onsubmit="return checkForm(this)">
<input type="button" class="button" value="bold" name="bold" onclick="javascript:tag('b', '[b]', 'bold*', '[/b]', 'bold', 'bold');" onMouseOver="helpline('bold')" />
<input type="button" class="button" value="italic" name="italic" onclick="javascript:tag('i', '[i]', 'italic*', '[/i]', 'italic', 'italic');" onMouseOver="helpline('italic')" />
<input type="button" class="button" value="underline" name="underline" onclick="javascript:tag('u', '[u]', 'underline*', '[/u]', 'underline', 'underline');" onMouseOver="helpline('underline')" />
<input type="button" class="button" value="quote" name="quote" onclick="javascript:tag('q', '[quote]', 'quote*', '[/quote]', 'quote', 'quote');" onMouseOver="helpline('quote')" />
<input type="button" class="button" value="code" name="code" onclick="javascript:tag('c', '[code]', 'code*', '
aми пише, че е добавен урока но когато вляза в него вместо да ми е удебел текста пише това в урока:Galli каза:', 'code', 'code');" onMouseOver="helpline('code')" />Код:<script src="editor.js" type="text/javascript" ></script> <? function bbcode($text){ $text=preg_replace("/\[b\](.+?)\[\/b\]/s", '<b>$1</b>',$text); $text=preg_replace("/\[i\](.+?)\[\/i\]/s", '<i>$1</i>',$text); $text=preg_replace("/\[u\](.+?)\[\/u\]/s", '<u>$1</u>',$text); $text=preg_replace("/\[quote\](.+?)\[\/quote\]/s", '<table cellspacing="1" width="100%" border="0"><tr><td>Quote:</td></tr><tr><td width="100%" style="border:solid 1px black">$1</td></tr></table>',$text); $text=preg_replace("/\[quote\=(.+?)](.+?)\[\/quote\]/s", '<table cellspacing="1" width="100%" border="0"><tr><td>$1 каза:</td></tr><tr><td width="100%" style="border:solid 1px black">$2</td></tr></table>',$text); $text=preg_replace("/\[url\](.+?)\[\/url\]/s", '<a href="$1">$1</a>',$text); $text=preg_replace("/\[url\=(.+?)\](.+?)\[\/url\]/s", '<a href="$1">$2</a>',$text); $text=preg_replace("/\[img\](.+?)\[\/img\]/s", '<img src="$1" alt="User submitted image" title="User submitted image"/>',$text); $text=preg_replace("/\[color\=(.+?)\](.+?)\[\/color\]/s", '<span style="color:$1">$2</span>',$text); $text=preg_replace("/\[size\=(.+?)\](.+?)\[\/size\]/s", '<span style="font-size:$1">$2</span>',$text); $text=preg_replace("/\[code\](.+?)\[\/code\]/s",'<table cellspacing="1" width="100%" border="0"><tr><td>Code:</td></tr><tr><td width="100%" style="border:solid 1px black">$1</td></tr></table>',$text); $text = nl2br($text); return $text; } $htmlcode = $_POST['post']; if (!$htmlcode){ ?> <form action="write.php" method="post" name="editform" onsubmit="return checkForm(this)"> <input type="button" class="button" value="bold" name="bold" onclick="javascript:tag('b', '[b]', 'bold*', '[/b]', 'bold', 'bold');" onMouseOver="helpline('bold')" /> <input type="button" class="button" value="italic" name="italic" onclick="javascript:tag('i', '[i]', 'italic*', '[/i]', 'italic', 'italic');" onMouseOver="helpline('italic')" /> <input type="button" class="button" value="underline" name="underline" onclick="javascript:tag('u', '[u]', 'underline*', '[/u]', 'underline', 'underline');" onMouseOver="helpline('underline')" /> <input type="button" class="button" value="quote" name="quote" onclick="javascript:tag('q', '[quote]', 'quote*', '[/quote]', 'quote', 'quote');" onMouseOver="helpline('quote')" /> <input type="button" class="button" value="code" name="code" onclick="javascript:tag('c', '[code]', 'code*', '
<input type="button" class="button" value="url" name="url" onclick="javascript:tag('url', '', 'url*', '', 'url', 'url');" onMouseOver="helpline('url')" />
<input type="button" class="button" value="img" name="img" onclick="javascript:tag('img', '', 'img', 'img');" onMouseOver="helpline('img')" />![]()
<hr>
Font size: <select name="fontsize" onChange="font('.value + ']', ''); this.selectedIndex=2;" onMouseOver="helpline('fontsize')" class="form_elements_dropdown">
<option value="50%" >Tiny</option>
<option value="75%" >Small</option>
<option value="100%" selected >Normal</option>
<option value="150%" >Large</option>
<option value="200%" >Huge</option>
</select>
Font color: <select name="fontcolor" onChange="font('[color=' + this.form.fontcolor.options[this.form.fontcolor.selectedIndex].value + ']', '[/color]'); this.selectedIndex=0;" onMouseOver="helpline('fontcolor')" class="form_elements_dropdown" >
<option value="black" style="color:black">Black</option>
<option value="silver" style="color:silver">Silver</option>
<option value="gray" style="color:gray">Gray</option>
<option value="maroon" style="color:maroon">Maroon</option>
<option value="red" style="color:red">Red</option>
<option value="purple" style="colorurple">Purple</option>
<option value="fuchsia" style="color:fuchsia">Fuchsia</option>
<option value="navy" style="color:navy">Navy</option>
<option value="blue" style="color:blue">Blue</option>
<option value="aqua" style="color:aqua">Aqua</option>
<option value="teal" style="color:teal">Teal</option>
<option value="lime" style="color:lime">Lime</option>
<option value="green" style="color:green">Green</option>
<option value="olive" style="colorlive">Olive</option>
<option value="yellow" style="color:yellow">Yellow</option>
<option value="white" style="color:white">White</option> </select>
<hr>
Заглавие<br />
<input name="zaglavie" type="text" size="26" />
<br />
<br />Текст<br />
<textarea rows="18" cols="50" name="post" class="form_elements_text"></textarea>
<br /><input name="submit" type="submit" class="Formstyles" value="Добави" width="64" height="19" />
<input name="reset" type="reset" class="Formstyles" title="reset" value="Изчисти">
</form>
<?
} else {
$htmlcode = htmlspecialchars("$htmlcode", ENT_QUOTES);
echo bbcode("$htmlcode");
}
?> [/code]
пиша ги с разстояние защото в форума се изписва като изтински bbcode[ b ]asd[/ b ]
<script src="editor.js" type="text/javascript" ></script>
<?
function bbcode($text){
$text=preg_replace("/\[b\](.+?)\[\/b\]/s", '<b>$1</b>',$text);
$text=preg_replace("/\[i\](.+?)\[\/i\]/s", '<i>$1</i>',$text);
$text=preg_replace("/\[u\](.+?)\[\/u\]/s", '<u>$1</u>',$text);
$text=preg_replace("/\[quote\](.+?)\[\/quote\]/s", '<table cellspacing="1" width="100%" border="0"><tr><td>Quote:</td></tr><tr><td width="100%" style="border:solid 1px black">$1</td></tr></table>',$text);
$text=preg_replace("/\[quote\=(.+?)](.+?)\[\/quote\]/s", '<table cellspacing="1" width="100%" border="0"><tr><td>$1 каза:</td></tr><tr><td width="100%" style="border:solid 1px black">$2</td></tr></table>',$text);
$text=preg_replace("/\[url\](.+?)\[\/url\]/s", '<a href="$1">$1</a>',$text);
$text=preg_replace("/\[url\=(.+?)\](.+?)\[\/url\]/s", '<a href="$1">$2</a>',$text);
$text=preg_replace("/\[img\](.+?)\[\/img\]/s", '<img src="$1" alt="User submitted image" title="User submitted image"/>',$text);
$text=preg_replace("/\[color\=(.+?)\](.+?)\[\/color\]/s", '<span style="color:$1">$2</span>',$text);
$text=preg_replace("/\[size\=(.+?)\](.+?)\[\/size\]/s", '<span style="font-size:$1">$2</span>',$text);
$text=preg_replace("/\[code\](.+?)\[\/code\]/s",'<table cellspacing="1" width="100%" border="0"><tr><td>Code:</td></tr><tr><td width="100%" style="border:solid 1px black">$1</td></tr></table>',$text);
$text = nl2br($text);
return $text;
}
$htmlcode = $_POST['post'];
if (!$htmlcode){
?>
<form action="" method="post" name="editform" onsubmit="return checkForm(this)">
<input type="button" class="button" value="bold" name="bold" onclick="javascript:tag('b', '[b]', 'bold*', '[/b]', 'bold', 'bold');" onMouseOver="helpline('bold')" />
<input type="button" class="button" value="italic" name="italic" onclick="javascript:tag('i', '[i]', 'italic*', '[/i]', 'italic', 'italic');" onMouseOver="helpline('italic')" />
<input type="button" class="button" value="underline" name="underline" onclick="javascript:tag('u', '[u]', 'underline*', '[/u]', 'underline', 'underline');" onMouseOver="helpline('underline')" />
<input type="button" class="button" value="quote" name="quote" onclick="javascript:tag('q', '[quote]', 'quote*', '[/quote]', 'quote', 'quote');" onMouseOver="helpline('quote')" />
<input type="button" class="button" value="code" name="code" onclick="javascript:tag('c', '[code]', 'code*', '
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="editor.js" type="text/javascript" ></script>
</head>
<!-- От тук започва PHP кода --!>
<?php
//Осъществяване на връзка с ДБ и добавям функцията bbcode
include ("config.php");
//Зимане на въведената информация
$name=$_POST['zaglavie'];
$urok=$_POST['post'];
if ((empty($name)) or (empty($urok))){
echo "<b>Моля, попълнете всички полета!</b>";
exit;
}
//bbcode
$urok = htmlspecialchars($urok);
$urok = addslashes($urok);
//Ето я заявката
$sql = "INSERT INTO `uroci` VALUES('', '$name', '$urok' );";
//Изпълнение на заявката и проверка дали информацията е добавена или не.
if(mysql_query($sql) != "")
{
echo "Урокът беше добавен успешно!<br><a href=\"index.php\">Виж добавените уроци</а><br>
<a href=\"add.php\">Добави още уроци</а> ";
}else
{
echo "НЕ! Урокът небеше добавен има грешка със mysql-a! <a href=\"add.php\">Върни се!</а>";
}
?>
function bbcode($text){
$text=preg_replace("/\[b\](.+?)\[\/b\]/s", '<b>$1</b>',$text);
$text=preg_replace("/\[i\](.+?)\[\/i\]/s", '<i>$1</i>',$text);
$text=preg_replace("/\[u\](.+?)\[\/u\]/s", '<u>$1</u>',$text);
$text=preg_replace("/\[quote\](.+?)\[\/quote\]/s", '<table cellspacing="1" width="100%" border="0"><tr><td>Quote:</td></tr><tr><td width="100%" style="border:solid 1px black">$1</td></tr></table>',$text);
$text=preg_replace("/\[quote\=(.+?)](.+?)\[\/quote\]/s", '<table cellspacing="1" width="100%" border="0"><tr><td>$1 каза:</td></tr><tr><td width="100%" style="border:solid 1px black">$2</td></tr></table>',$text);
$text=preg_replace("/\[url\](.+?)\[\/url\]/s", '<a href="$1">$1</a>',$text);
$text=preg_replace("/\[url\=(.+?)\](.+?)\[\/url\]/s", '<a href="$1">$2</a>',$text);
$text=preg_replace("/\[img\](.+?)\[\/img\]/s", '<img src="$1" alt="User submitted image" title="User submitted image"/>',$text);
$text=preg_replace("/\[color\=(.+?)\](.+?)\[\/color\]/s", '<span style="color:$1">$2</span>',$text);
$text=preg_replace("/\[size\=(.+?)\](.+?)\[\/size\]/s", '<span style="font-size:$1">$2</span>',$text);
$text=preg_replace("/\[code\](.+?)\[\/code\]/s",'<table cellspacing="1" width="100%" border="0"><tr><td>Code:</td></tr><tr><td width="100%" style="border:solid 1px black">$1</td></tr></table>',$text);
$text = nl2br($text);
return $text;
}
ами сложих го това в файла write пак така - нестанаGalli каза:Ясно, значи ги записваш в база данни.
Във файла, с който ги взимаш от базата данни, трябва да сложиш тази функция
и след това където показваш урока примерно такаКод:function bbcode($text){ $text=preg_replace("/\[b\](.+?)\[\/b\]/s", '<b>$1</b>',$text); $text=preg_replace("/\[i\](.+?)\[\/i\]/s", '<i>$1</i>',$text); $text=preg_replace("/\[u\](.+?)\[\/u\]/s", '<u>$1</u>',$text); $text=preg_replace("/\[quote\](.+?)\[\/quote\]/s", '<table cellspacing="1" width="100%" border="0"><tr><td>Quote:</td></tr><tr><td width="100%" style="border:solid 1px black">$1</td></tr></table>',$text); $text=preg_replace("/\[quote\=(.+?)](.+?)\[\/quote\]/s", '<table cellspacing="1" width="100%" border="0"><tr><td>$1 каза:</td></tr><tr><td width="100%" style="border:solid 1px black">$2</td></tr></table>',$text); $text=preg_replace("/\[url\](.+?)\[\/url\]/s", '<a href="$1">$1</a>',$text); $text=preg_replace("/\[url\=(.+?)\](.+?)\[\/url\]/s", '<a href="$1">$2</a>',$text); $text=preg_replace("/\[img\](.+?)\[\/img\]/s", '<img src="$1" alt="User submitted image" title="User submitted image"/>',$text); $text=preg_replace("/\[color\=(.+?)\](.+?)\[\/color\]/s", '<span style="color:$1">$2</span>',$text); $text=preg_replace("/\[size\=(.+?)\](.+?)\[\/size\]/s", '<span style="font-size:$1">$2</span>',$text); $text=preg_replace("/\[code\](.+?)\[\/code\]/s",'<table cellspacing="1" width="100%" border="0"><tr><td>Code:</td></tr><tr><td width="100%" style="border:solid 1px black">$1</td></tr></table>',$text); $text = nl2br($text); return $text; }
echo $row['urok'];
го правиш така
echo bbcode($row['urok']);