Code lập trình - Bài 7 & 8

Chia sẻ: Qdasdasdasd Dasdasdsd | Ngày: | Loại File: PDF | Số trang:9

0
108
lượt xem
29
download

Code lập trình - Bài 7 & 8

Mô tả tài liệu
  Download Vui lòng tải xuống để xem tài liệu đầy đủ

Tài liệu tham khảo viết code lập trình cho internet về Thay skin; Music

Chủ đề:
Lưu

Nội dung Text: Code lập trình - Bài 7 & 8

  1. Bài 7: Thay skin Tác giả: Phan Hồng Phúc (phucorcl@yahoo.com) 1. Hình vẽ 2. Copy images đè lên các file trong thư mục forum_images 3. Copy default_style vào thư mục css_styles Bài 8: Music Tác giả: Phan Hồng Phúc (phucorcl@yahoo.com) 1. Mở file functions_format_post.asp a.1. Tìm dòng code
  2. 'Return the function searchHighlighter = strTempMessage End Function a.2. Thêm xuống dưới Function formatWMAPL(ByVal strMessage) 'Declare variables Dim lngStartPos 'Holds search start postions Dim lngEndPos 'Holds end start postions Dim saryWMAAttributes 'Holds the features of the input WMA file Dim intAttrbuteLoop 'Holds the attribute loop counter Dim strWMAWidth 'Holds the string value of the width of the WMA file Dim intWMAWidth 'Holds the interger value of the width of the WMA file Dim strWMAHeight 'Holds the string value of the height of the WMA file Dim intWMAHeight 'Holds the interger value of the height of the WMA file Dim strBuildWMALink 'Holds the converted BBcode for the WMA file Dim strTempWMAMsg 'Tempoary store for the BBcode Dim strWMALink 'Holds the link to the WMA file 'Loop through all the codes in the message and convert them to formated WMA links Do While InStr(1, strMessage, "[MUSIC", 1) > 0 AND InStr(1, strMessage, "[/MUSIC]", 1) > 0 'Initiliase variables intWMAWidth = 300 intWMAHeight = 300 strWMALink = "" strBuildWMALink = "" strTempWMAMsg = ""
  3. 'Get the WMA BBcode from the message lngStartPos = InStr(1, strMessage, "[MUSIC", 1) lngEndPos = InStr(lngStartPos, strMessage, "[/MUSIC]", 1) + 8 'Make sure the end position is not in error If lngEndPos < lngStartPos Then lngEndPos = lngStartPos + 6 'Get the original WMA BBcode from the message strTempWMAMsg = Trim(Mid(strMessage, lngStartPos, lngEndPos- lngStartPos)) 'Get the start and end in the message of the attributes of the WMA file lngStartPos = InStr(1, strTempWMAMsg, "[MUSIC", 1) + 6 lngEndPos = InStr(lngStartPos, strTempWMAMsg, "]", 1) 'Make sure the end position is not in error If lngEndPos < lngStartPos Then lngEndPos = lngStartPos 'If there is something returned get the details (eg. dimensions) of the WMA file If strTempWMAMsg "" Then 'Place any attributes for the WMA file in an array saryWMAAttributes = Split(Trim(Mid(strTempWMAMsg, lngStartPos, lngEndPos-lngStartPos)), " ") 'Get the dimensions of the WMA file 'Loop through the array of atrributes that are for the falsh file to get the dimentions For intAttrbuteLoop = 0 To UBound(saryWMAAttributes)
  4. 'If this is the width attribute then read in the width dimention If InStr(1, saryWMAAttributes(intAttrbuteLoop), "WIDTH=", 1) Then 'Get the width dimention strWMAWidth = Replace(saryWMAAttributes(intAttrbuteLoop), "WIDTH=", "", 1, -1, 1) 'Make sure we are left with a numeric number if so convert to an interger and place in an interger variable If isNumeric(strWMAWidth) Then intWMAWidth = CInt(strWMAWidth) End If 'If this is the height attribute then read in the height dimention If InStr(1, saryWMAAttributes(intAttrbuteLoop), "HEIGHT=", 1) Then 'Get the height dimention strWMAHeight = Replace(saryWMAAttributes(intAttrbuteLoop), "HEIGHT=", "", 1, -1, 1) 'Make sure we are left with a numeric number if so convert to an interger and place in an interger variable If isNumeric(strWMAHeight) Then intWMAHeight = CInt(strWMAHeight) End If Next 'Get the link to the WMA file
  5. lngStartPos = InStr(1, strTempWMAMsg, "]", 1) + 1 lngEndPos = InStr(lngStartPos, strTempWMAMsg, "[/MUSIC]", 1) 'Make sure the end position is not in error If lngEndPos < lngStartPos Then lngEndPos = lngStartPos + 8 'Read in the code to be converted into a hyperlink from the message strWMALink = Trim(Mid(strTempWMAMsg, lngStartPos, (lngEndPos - lngStartPos))) 'Build the HTML for the displying of the WMA file If strWMALink "" Then '========================================================== ============ strBuildWMALink="" & _ ""& _ ""& _ ""& _ ""& _ ""& _ ""& _ ""& _ ""& _ ""& _ ""& _ ""& _
  6. ""& _ ""& _ ""& _ ""& _ ""& _ ""& _ ""& _ ""& _ ""& _ ""& _ ""& _ ""& _ ""& _ ""& _ ""& _ ""& _ "" End If End If 'Replace the WMA codes in the message with the new formated WMA link If strBuildWMALink "" Then strMessage = Replace(strMessage, strTempWMAMsg, strBuildWMALink, 1, -1, 1) Else strMessage = Replace(strMessage, strTempWMAMsg, Replace(strTempWMAMsg, "[", "&#91;", 1, -1, 1), 1, -1, 1) End If
  7. Loop 'Return the function formatWMAPL= strMessage End Function 2. Mở file forum_posts.asp a.1. Tìm dòng code If blnFlashFiles Then If InStr(1, strMessage, "[FLASH", 1) > 0 AND InStr(1, strMessage, "[/FLASH]", 1) > 0 Then strMessage = formatFlash(strMessage) If InStr(1, strAuthorSignature, "[FLASH", 1) > 0 AND InStr(1, strAuthorSignature, "[/FLASH]", 1) > 0 Then strAuthorSignature = formatFlash(strAuthorSignature) End If a.2. Thêm xuống dưới If InStr(1, strMessage, "[MUSIC", 1) > 0 AND InStr(1, strMessage, "[/MUSIC]", 1) > 0 Then strMessage = formatWMAPL(strMessage) End If 3. Mở file forum_codes.asp a.1. Tìm dòng code If blnFlashFiles Then %> [FLASH WIDTH=50 HEIGHT=50]http://www.myWeb.com/flash.swf[/FLASH]
  8. [FLASH WIDTH=150 HEIGHT=150]http://www.hoaian.net/flash.swf[/FLASH] [MUSIC WIDTH=300 HEIGHT=300]http://www.hoaian.net/media.wma[/MUSIC]
  9. Const strTxtMediaFiles = "Music"  
Đồng bộ tài khoản