Forumda Kod Kullanma // Asp
-
s.a
bi forum üstünde çalışıyorum. kendi yapmaya çalıştığım rte ile mesela bi buton var ona tıklayınca [code] blablabla [/code] taglarını çıkarıyor
ama forumda bunun böyle görünmesi yerine foruma girince daha sexy bi tablo içinde görünmesini istiyorum. replace ile denedim saçmaladım gibime geldi
ne yapmam lazım
-
Dostum aslında mantık basit
[code]
yazan yeri bununla değiştir
<table border="1" width="100%">
<tr>
<td>[/code] yazan yeri de bununla değiştir.
</td>
</tr>
</table>Tablo rengini felan sen ayarlarsın artık
Neticede yazı kısmı ortaya gelecektir.Ya da Bu biraz zor geldi diyorsan.Mydesign ziyaretçi defterini incele, alıntı yapma mantığı.
-
tmm replace ile yapıyorum şimdi sağol bi deneyim
-
şunun bi örneği varmı hacım acaba replace hata verip duruyo
-
<%
'// Forum kodlarını düzenleme fonksiyonu
Function MesajFormatla(byVal strMesaj)
'// Mesajda [code] ile alıntı yapılmışsa, mesaj düzenleniyor
Do While InStr(strMesaj, "[code]") > 0 AND InStr(strMesaj, "[/code]") > 0DeyimBaslangici = InStr(strMesaj, "[code]") + 6
DeyimSonu = InStr(DeyimBaslangici, strMesaj, "[/code]", 1)If DeyimSonu < DeyimBaslangici Then DeyimSonu = DeyimBaslangici + 6
If DeyimSonu > DeyimBaslangici Then
strAlintiMesaji = Trim(Mid(strMesaj, DeyimBaslangici, DeyimSonu-DeyimBaslangici))
strAlinti = "<table width=""95%"" border=""0"" align=""center"" cellpadding=""0"" cellspacing=""0"">"
strAlinti = strAlinti & vbCrLf & "<tr><td class=""bYazi"">Kod Alanı: <br>"
strAlinti = strAlinti & vbCrLf & " <table width=""100%"" border=""0"" cellpadding=""1""cellspacing=""0"" bgcolor=""#CCCCCC"">"
strAlinti = strAlinti & vbCrLf & " <tr>"
strAlinti = strAlinti & vbCrLf & " <td><table width=""100%"" border=""0"" cellpadding=""2""cellspacing=""0"" bgcolor=""#EEEEEE"">"
strAlinti = strAlinti & vbCrLf & " <tr>"
strAlinti = strAlinti & vbCrLf & " <td>" & strAlintiMesaji & "</td>"
strAlinti = strAlinti & vbCrLf & " </tr>"
strAlinti = strAlinti & vbCrLf & " </table></td>"
strAlinti = strAlinti & vbCrLf & " </tr>"
strAlinti = strAlinti & vbCrLf & " </table></td>"
strAlinti = strAlinti & vbCrLf & "</tr>"
strAlinti = strAlinti & vbCrLf & "</table>"
End IfDeyimBaslangici = InStr(strMesaj, "[code]")
DeyimSonu = InStr(DeyimBaslangici, strMesaj, "[/code]", 1) + 7If DeyimSonu < DeyimBaslangici Then DeyimSonu = DeyimBaslangici + 6
strAsilMesaj = Trim(Mid(strMesaj, DeyimBaslangici, DeyimSonu-DeyimBaslangici))
If strAlinti <> "" Then
strMesaj = Replace(strMesaj, strAsilMesaj, strAlinti, 1, -1, 1)
Else
strMesaj = Replace(strMesaj, strAsilMesaj, Replace(strAsilMesaj, "[", "[", 1, -1, 1), 1, -1, 1)
End If
LoopMesajFormatla = strMesaj
End Function
%>
Kullanımı aşağıdaki gibi
<%
merhaba = "[code]Geliyormusun[/code]"
response.write Mesajformatla(merhaba)
%>
