Добавяне на емотикони в коментари

bankera1990

Registered
Някой ще се опитали да ми добави емотикони в коментарите

това е формата

Код:
<form name="edit" method="post" action="add_comment.php">
								
										
<textarea class="textarea textarea_full" id="field_comment_body" cols="40" rows="5" name="body"></textarea><input type="hidden" name="user" value="<? echo $row['username']; ?>">
<input type="hidden" name="author" value="<? echo $_SESSION['username']; ?>">
<input type="hidden" name="userid" value="<? echo $row['id']; ?>"></dd>
										   <input class="submit" name="submit" value="Добави" type="submit"><br><br>
									
								
								<input name="isguestbook" value="1" type="hidden">
								<input name="isprofile" value="1" type="hidden">
							</form>

това е кода за коментарите
Код:
<?
$user = $row['username'];
$sql23 = mysql_query("SELECT * FROM comments WHERE user='$user' ORDER BY id DESC LIMIT 0,10");
while($r = mysql_fetch_array($sql23)) {
$post = $r['post'];
$post = htmlspecialchars("$post", ENT_QUOTES);
$post = bbcode($post);
$author = $r['author'];
$sql2233 = mysql_query("SELECT * FROM users WHERE username='$author'");
$s = mysql_fetch_array($sql2233);
$oactive = $s['oactive'];
if($oactive == "no")
{
$pic = 'wroot/no_photo.jpg';
}
else
{
$pic = $s['osnovna'];
}
$user2 = $_SESSION['username'];
if($user == $user2)
{
$comdel = ' <a href="del_comment.php?cid='.$r[id].'&uid='.$row[id].'">[изтрий]</a>';
}
echo '<div class="dataitem odd">
					<table>
						<tbody><tr>
							<td>
								<div class="image">
										<a class="thumbnail" href="'.$siteurl.$s[id].'"><img src="resize.php?img='.$pic.'" alt="" border="0"><span><img src="'.$pic.'"></span><br></a>
								</div>
							</td>
						    <td class="data">
								<div class="itemheader">
									<h2 class="inner">
	<a href="'.$siteurl.$s[id].'">'.$s[username].'</a>
	</h2>

									<ul class="itemheader">
										<li>Пуснат на '.$r[date].'</li>
																			</ul>
									<div class="clear"></div>
								</div>
								<div class="entry">
									'.$post.$comdel.'								</div>
							</td>
						</tr>
					</tbody></table>
				</div>';
}
?>

аз се опитах да добавя това но не се получава

Код:
 $comments = $row['komentar']; 
                  $comments = str_replace(":8","<img src='smiles/0.gif'>",$comments); 
                  $comments = str_replace(":D","<img src='smiles/1.gif'>",$comments); 
                  $comments = str_replace(":P","<img src='smiles/2.gif'>",$comments); 
                  $comments = str_replace(":clap","<img src='smiles/98.gif'>",$comments); 
                  $comments = str_replace(";(","<img src='smiles/4.gif'>",$comments); 
                  $comments = str_replace("hw)","<img src='smiles/5.gif'>",$comments); 
                  $comments = str_replace("8)","<img src='smiles/6.gif'>",$comments); 
                  $comments = str_replace(":lol:","<img src='smiles/7.gif'>",$comments); 
                  $comments = str_replace(":x","<img src='smiles/8.gif'>",$comments); 
                  $comments = str_replace(":sun","<img src='smiles/9.gif'>",$comments); 
                  $comments = str_replace("8-)","<img src='smiles/10.gif'>",$comments); 
                  $comments = str_replace(":lolipop:","<img src='smiles/11.gif'>",$comments); 
                  $comments = str_replace("m)","<img src='smiles/12.gif'>",$comments); 
                  $comments = str_replace("!","<img src='smiles/13.gif'>",$comments); 
                  $comments = str_replace("?","<img src='smiles/14.gif'>",$comments);
                  $comments = str_replace(":%:","<img src='smiles/15.gif'>",$comments);
 				  $comments = str_replace(":dawn:","<img src='smiles/16.gif'>",$comments); 	
				  $comments = str_replace(":up:","<img src='smiles/17.gif'>",$comments); 	
				  $comments = str_replace(":smoke:","<img src='smiles/18.gif'>",$comments); 	
				  $comments = str_replace(":alkohol:","<img src='smiles/19.gif'>",$comments); 	
				  $comments = str_replace(":angel:","<img src='smiles/20.gif'>",$comments); 	
				  $comments = str_replace(":loveit:","<img src='smiles/21.gif'>",$comments); 	
				  $comments = str_replace(":^:","<img src='smiles/22.gif'>",$comments); 	
				  $comments = str_replace(":e:","<img src='smiles/23.gif'>",$comments); 	
				  $comments = str_replace(":*:","<img src='smiles/24.gif'>",$comments); 	
				  $comments = str_replace(":cupidon:","<img src='smiles/25.gif'>",$comments); 
				  $comments = str_replace(":h:","<img src='smiles/28.gif'>",$comments); 	
				  $comments = str_replace("::-):","<img src='smiles/45.gif'>",$comments); 	
                  $comments = str_replace(":^.^:","<img src='smiles/54.gif'>",$comments); 
				  $comments = str_replace(":crazy:","<img src='smiles/62.gif'>",$comments); 
				  $comments = str_replace(":@:","<img src='smiles/95.gif'>",$comments); 
				  $comments = str_replace(":sram:","<img src='smiles/111.gif'>",$comments); 
				  $comments = str_replace(":dj:","<img src='smiles/125.gif'>",$comments); 
 				  $comments = str_replace(":+:","<img src='smiles/plus.gif'>",$comments); 
				  $comments = str_replace(":-:","<img src='smiles/minus.gif'>",$comments); 
                  $text = '$comments';
 
bankera1990 каза:
Някой ще се опитали да ми добави емотикони в коментарите

това е формата

Код:
<form name="edit" method="post" action="add_comment.php">
								
										
<textarea class="textarea textarea_full" id="field_comment_body" cols="40" rows="5" name="body"></textarea><input type="hidden" name="user" value="<? echo $row['username']; ?>">
<input type="hidden" name="author" value="<? echo $_SESSION['username']; ?>">
<input type="hidden" name="userid" value="<? echo $row['id']; ?>"></dd>
										   <input class="submit" name="submit" value="Добави" type="submit"><br><br>
									
								
								<input name="isguestbook" value="1" type="hidden">
								<input name="isprofile" value="1" type="hidden">
							</form>

това е кода за коментарите
Код:
<?
$user = $row['username'];
$sql23 = mysql_query("SELECT * FROM comments WHERE user='$user' ORDER BY id DESC LIMIT 0,10");
while($r = mysql_fetch_array($sql23)) {
$post = $r['post'];
$post = htmlspecialchars("$post", ENT_QUOTES);
$post = bbcode($post);
$author = $r['author'];
$sql2233 = mysql_query("SELECT * FROM users WHERE username='$author'");
$s = mysql_fetch_array($sql2233);
$oactive = $s['oactive'];
if($oactive == "no")
{
$pic = 'wroot/no_photo.jpg';
}
else
{
$pic = $s['osnovna'];
}
$user2 = $_SESSION['username'];
if($user == $user2)
{
$comdel = ' <a href="del_comment.php?cid='.$r[id].'&uid='.$row[id].'">[изтрий]</a>';
}
echo '<div class="dataitem odd">
					<table>
						<tbody><tr>
							<td>
								<div class="image">
										<a class="thumbnail" href="'.$siteurl.$s[id].'"><img src="resize.php?img='.$pic.'" alt="" border="0"><span><img src="'.$pic.'"></span><br></a>
								</div>
							</td>
						    <td class="data">
								<div class="itemheader">
									<h2 class="inner">
	<a href="'.$siteurl.$s[id].'">'.$s[username].'</a>
	</h2>

									<ul class="itemheader">
										<li>Пуснат на '.$r[date].'</li>
																			</ul>
									<div class="clear"></div>
								</div>
								<div class="entry">
									'.$post.$comdel.'								</div>
							</td>
						</tr>
					</tbody></table>
				</div>';
}
?>

аз се опитах да добавя това но не се получава

Код:
 $comments = $row['komentar']; 
                  $comments = str_replace(":8","<img src='smiles/0.gif'>",$comments); 
                  $comments = str_replace(":D","<img src='smiles/1.gif'>",$comments); 
                  $comments = str_replace(":P","<img src='smiles/2.gif'>",$comments); 
                  $comments = str_replace(":clap","<img src='smiles/98.gif'>",$comments); 
                  $comments = str_replace(";(","<img src='smiles/4.gif'>",$comments); 
                  $comments = str_replace("hw)","<img src='smiles/5.gif'>",$comments); 
                  $comments = str_replace("8)","<img src='smiles/6.gif'>",$comments); 
                  $comments = str_replace(":lol:","<img src='smiles/7.gif'>",$comments); 
                  $comments = str_replace(":x","<img src='smiles/8.gif'>",$comments); 
                  $comments = str_replace(":sun","<img src='smiles/9.gif'>",$comments); 
                  $comments = str_replace("8-)","<img src='smiles/10.gif'>",$comments); 
                  $comments = str_replace(":lolipop:","<img src='smiles/11.gif'>",$comments); 
                  $comments = str_replace("m)","<img src='smiles/12.gif'>",$comments); 
                  $comments = str_replace("!","<img src='smiles/13.gif'>",$comments); 
                  $comments = str_replace("?","<img src='smiles/14.gif'>",$comments);
                  $comments = str_replace(":%:","<img src='smiles/15.gif'>",$comments);
 				  $comments = str_replace(":dawn:","<img src='smiles/16.gif'>",$comments); 	
				  $comments = str_replace(":up:","<img src='smiles/17.gif'>",$comments); 	
				  $comments = str_replace(":smoke:","<img src='smiles/18.gif'>",$comments); 	
				  $comments = str_replace(":alkohol:","<img src='smiles/19.gif'>",$comments); 	
				  $comments = str_replace(":angel:","<img src='smiles/20.gif'>",$comments); 	
				  $comments = str_replace(":loveit:","<img src='smiles/21.gif'>",$comments); 	
				  $comments = str_replace(":^:","<img src='smiles/22.gif'>",$comments); 	
				  $comments = str_replace(":e:","<img src='smiles/23.gif'>",$comments); 	
				  $comments = str_replace(":*:","<img src='smiles/24.gif'>",$comments); 	
				  $comments = str_replace(":cupidon:","<img src='smiles/25.gif'>",$comments); 
				  $comments = str_replace(":h:","<img src='smiles/28.gif'>",$comments); 	
				  $comments = str_replace("::-):","<img src='smiles/45.gif'>",$comments); 	
                  $comments = str_replace(":^.^:","<img src='smiles/54.gif'>",$comments); 
				  $comments = str_replace(":crazy:","<img src='smiles/62.gif'>",$comments); 
				  $comments = str_replace(":@:","<img src='smiles/95.gif'>",$comments); 
				  $comments = str_replace(":sram:","<img src='smiles/111.gif'>",$comments); 
				  $comments = str_replace(":dj:","<img src='smiles/125.gif'>",$comments); 
 				  $comments = str_replace(":+:","<img src='smiles/plus.gif'>",$comments); 
				  $comments = str_replace(":-:","<img src='smiles/minus.gif'>",$comments); 
                  $text = '$comments';

tuk
 

Back
Горе