AnonJr
Moderator
United States
5768 Posts |
Posted - 29 August 2007 : 14:40:25
|
JJenson, do a "View Source" or Right-click on the link and "Save Target As..." - his web server is processing the page instead of displaying it as a .txt file. Doing a "View Source" showed this:
I wrote this mod for Snitz Forum to use a simple forum code like:
[youtube]gJmX1z1NY2c[/youtube]
to embed a youtube video in the forum.
Modify "inc_func_common.asp" adding the following function at the end of the file, before the <script> section:
____________________________________
<% Function ReplaceYouTubeTags(fString) Dim oTag, cTag Dim roTag1, rcTag1, roTag2, rcTag2 Dim oTagPos, cTagPos Dim nTagPos Dim counter1, counter2 Dim strCodeText Dim Tagcount Dim strTempString, strResultString TagCount = 1 Dim CodeTags(1,2,3) Dim strArray, strArray2
CodeTags(1,1,1) = "[youtube]" CodeTags(1,2,1) = "[/youtube]" CodeTags(1,1,2) = "<object width=""425"" height=""353""><param name=""movie"" value=""http://www.youtube.com/v/" CodeTags(1,2,2) = """></param><param name=""wmode"" value=""transparent""></param>" CodeTags(1,1,3) = "<embed src=""http://www.youtube.com/v/" CodeTags(1,2,3) = """ type=""application/x-shockwave-flash"" wmode=""transparent"" width=""425"" height=""353""></embed></object>"
strResultString = "" strTempString = fString
for counter1 = 1 to TagCount
oTag = CodeTags(counter1,1,1) roTag1 = CodeTags(counter1,1,2) roTag2 = CodeTags(counter1,1,3) cTag = CodeTags(counter1,2,1) rcTag1 = CodeTags(counter1,2,2) rcTag2 = CodeTags(counter1,2,3) oTagPos = InStr(1, strTempString, oTag, 1) cTagPos = InStr(1, strTempString, cTag, 1)
if (oTagpos > 0) and (cTagPos > 0) then strArray = Split(strTempString, oTag, -1, 1) for counter2 = 0 to Ubound(strArray) if (Instr(1, strArray(counter2), cTag) > 0) then strArray2 = split(strArray(counter2), cTag, -1, 1) strCodeText = trim(strArray2(0)) strCodeText = replace(strCodeText, """", " ") ' ## filter out " '## Added to exclude Javascript and other potentially hazardous characters strCodeText = replace(strCodeText, "&", " ", 1, -1, 1) ' ## filter out & strCodeText = replace(strCodeText, "#", " ", 1, -1, 1) ' ## filter out # strCodeText = replace(strCodeText, ";", " ", 1, -1, 1) ' ## filter out ; strCodeText = replace(strCodeText, "+", " ", 1, -1, 1) ' ## filter out + strCodeText = replace(strCodeText, "(", " ", 1, -1, 1) ' ## filter out ( strCodeText = replace(strCodeText, ")", " ", 1, -1, 1) ' ## filter out ) strCodeText = replace(strCodeText, "[", " ", 1, -1, 1) ' ## filter out [ strCodeText = replace(strCodeText, "]", " ", 1, -1, 1) ' ## filter out ] strCodeText = replace(strCodeText, "=", " ", 1, -1, 1) ' ## filter out = strCodeText = replace(strCodeText, "*", " ", 1, -1, 1) ' ## filter out * strCodeText = replace(strCodeText, "'", " ", 1, -1, 1) ' ## filter out ' strCodeText = replace(strCodeText, vbTab, " ", 1, -1, 1) ' ## filter out Tabs strCodeText = replace(strCodeText, "view-source", " ", 1, -1, 1) ' ## filter out view-source strCodeText = replace(strCodeText, "javascript", " ", 1, -1, 1) ' ## filter out javascript strCodeText = replace(strCodeText, "jscript", " ", 1, -1, 1) ' ## filter out jscript strCodeText = replace(strCodeText, "vbscript", " ", 1, -1, 1) ' ## filter out vbscript strCodeText = replace(strCodeText, "mailto", " ", 1, -1, 1) ' ## filter out mailto '## End Added strCodeText = replace(strCodeText, "<", " ") ' ## filter out < strCodeText = replace(strCodeText, ">", " ") ' ## filter out > strCodeText = replace(strCodeText, "<br />", vbNewLine) strResultString = strResultString & roTag1 & strCodeText & rcTag1 & roTag2 & strCodeText & rcTag2 & strArray2(1) else strResultString = strResultString & strArray(counter2) end if next
strTempString = strResultString strResultString = "" end if next
ReplaceYouTubeTags = strTempString end function %> ____________________________________
At line 239 change:
____________________________________
if strAllowForumCode = "1" then fString = extratags(fString) end if ____________________________________
to ____________________________________
if strAllowForumCode = "1" then fString = extratags(fString) fString = ReplaceYouTubeTags(fString) end if ____________________________________
Now you can use the brand new forum code!
If you want, you can modify "pop_forum_code.asp", adding the following code before if (strIMGInPosts = "1"), at line 158.
____________________________________
Response.Write "<p><b>YouTube:</b> Enclose the video hash code with [youtube] and [/youtube] . <i>Example:</i> Here is a video: <b>[youtube]</b>gJmX1z1NY2c<b>[/youtube]</b></p>" & vbNewLine ____________________________________
Ciao! Luca Panella
29-Aug-2007
< |
|
|