fm_GoodLinks(), Daha Kullanışlı Linkler

18.08.2003

Okuyucu : 4.819
Günlük Okuyucu : 2,7

Bu kod sayesinde linklerinizi site içerisi, dite dışarısı, download, pdf doküman vs. gibi kategorilere ayırabilir, buna göre ek ikon gösterebilir yada linkin target' ını değiştirebilirsiniz.

Kaynak Kodunu Download Edin (Download Source Code);

/opensource/source-code/fmgoodlinks.txt

Kaynak Kod;

1 : <%
2 :     '***Good Links By Ferruh Mavituna v1.8
3 :     '//NFO//
4 :     '    Make links with alt text and Icons
5 :     '    http://ferruh.mavituna.com
6 :     '//ARGUMENTS//
7 :     '    DbNews : Text
8 :     '//SAMPLE//
9 :     '    Response.Write fm_GoodLinks(Rs(News))
10 :     '************************************
11 :     '// 04.10.2003
12 :     '// New Formats ed2K

14 :     Function fm_GoodLinks(byVal DbNews)
15 :         Dim Xpos, i, Xarr(), Xcounter, XIcon, XIconExp, Xtarget, HrefLink, ShortLink
16 :         DbNews = " " & DbNews
17 :         Xpos = Instr(DbNews,"<a href=""")-1

19 :         If Xpos > 0 Then
20 :             While Xpos<>0
21 :                 If Xpos = 2 Then Xpos = 1

23 :                 '// Put all replace things to a an Array
24 :                 ReDim Preserve Xarr(Xcounter)

26 :                 '// Get link
27 :                 HrefLink = fm_ValueSpider(DbNews, "<a href=""", """>", Xpos)
28 :                 Xarr(Xcounter) = HrefLink

30 :                 Xpos = Instr(Xpos,DbNews,"<a href=""")
31 :                 
32 :                 If Xpos > 0 Then Xpos = Xpos + Len(HrefLink) + Len(ShortLink)
33 :                 Xcounter = Xcounter+1
34 :             Wend
35 :         End If
36 :         
37 :         '// Replace All
38 :         For i = 0 to Xcounter-1
39 :             Xtarget=""
40 :             
41 :             '// Determine Link Type
42 :             Select Case LCase(Right(Xarr(i),3))
43 :                 Case "zip","rar"
44 :                     XIcon = "d"
45 :                     XIconExp = "Download (zip)"
46 :                     XTarget = " target=""_self"" "
47 :                 Case "pdf"
48 :                     XIcon = "pdf"
49 :                     XIconExp = "Download (pdf)"
50 :                 Case "gif","jpg","jpeg","png"
51 :                     XIcon = "gfx"
52 :                     XIconExp = "Graphic"
53 :                 Case "c","cpp"
54 :                     XIcon = "c"
55 :                     XIconExp = "C/C++ Source Code"
56 :                 Case "swf"
57 :                     XIcon = "fls"
58 :                     XIconExp = "Flash Animation"
59 :                 Case Else
60 :                     XIcon = "w"
61 :                     '// Check in or out link
62 :                         XTarget = " target=""_blank"" "
63 :                         XIconExp = "Site Dışı (yeni pencere)"
64 :                         '// Outside
65 :                         If NOT LCase(Left(Xarr(i),4)) = "http" Then XIconExp = "Site içi" : XTarget = " target=""_self"" "
66 :                         
67 :                         '// FTP
68 :                         If LCase(Left(Xarr(i),6)) = "ftp://" Then XIconExp = "FTP Adressi" : XTarget = " " : XIcon = "ftp"
69 :                         
70 :                         '// Edonkey
71 :                         If LCase(Left(Xarr(i),6)) = "ed2k://" Then XIconExp = "E-donkey File Download" : XTarget = " " : XIcon = "ed2K"
72 :             End Select
73 :             If XIconExp <> "" Then XIconExp = "<strong>" & XIconExp & "</strong>"
74 :             
75 :             '// Truncate it if it's long
76 :             Shortlink = fm_Cutter(Xarr(i),75,false,"...")
77 :             DbNews = Replace(DbNews, "<a href=""" & Xarr(i) & """>","<a href=""" & Xarr(i) & """ help=""" & XIconExp & " <br /> " & ShortLink & """"& Xtarget &">" & "[" & XIcon & "] ")
78 :         Next

80 :         fm_GoodLinks = DbNews
81 :     End Function
82 :     '************************************
83 : %>
Source Script is modified version of HiLiter

Yorumlar

RSS Bu makalenin yorumlarını RSS ile takip et!

http://www.renklifonksiyon.cjb.net

Burda da benim yazdığım bir tane var, bakar ve yorumlarsanız sevinirim :)

Tuncay Kınalı [ # | 21.06.2004 ]

Buradaki fm_Valuspider fonksiyonu nedir ? kodlarda görünmüyor ?

OlcayUZUN [ # | 06.06.2005 ]

Yorum Ekle





Kullanılabilir Taglar : [<blockquote>] [<strong>] [<em>]

Diğer Yazılar

Neredeyim ?

Ferruh.Mavituna » Kod Parçaları (Code Snippets) » fm_GoodLinks(), Daha Kullanışlı Linkler

Ferruh Mavituna
© 2002-2007, Ferruh Mavituna

Sabit IP Adresi : 81.22.99.133, SSL Erişimi, Hakkında