ASP: need help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thesinnerishere
    New Member
    • Jul 2008
    • 6

    ASP: need help

    i have created a program(link-generator) which is static in nature(it works correctly) meaning that this program must find the symbol { } first for it to operate properly.how can i make it dynamic so that it can be handled properly regardless of { } symbol ?

    anyone please reply!
    here is the code:
    Code:
     
    <%
    Dim strMessage
     
    strMessage = "[!*!$!This is*$|198545] a new {!Research & Developement|newresearch } *!assignment* for {!Sanju Shakya}. This is provided"
    strMessage = strMessage & " on [!20080331|51]. This will {!*!$!be totally developed on Classic ASP*$|Classic ASP} and nothing"
    strMessage = strMessage & " other tools. This $!*!should be done*$ within [!*!$!today*$|2].{! }"
     
     
    Function fnSplit(strMessage)	
    	Dim buffer
    	Dim strRemain
    	Dim buffer1
    	Dim strNew1
    	Dim strRemain1
    	Dim strRemainder
    	Dim strnewpart
     
    	strRemainder=strMessage	
     
    		If instr(strRemainder,"{!") > 0 Then 
    			buffer=split(strRemainder,"{!",2)
    			strNew=buffer(0) 
    					' for bold 
    				If instr(strNew,"*!")> 0 Then
    					strNew = Replace(strNew, "*!","<b>")
    					strNew = Replace(strNew, "*","</b>")
    				End If
     
    				' for italics
    				If instr(strNew,"$!")> 0 Then
    					strNew = Replace(strNew, "$!","<i>")
    					strNew = Replace(strNew, "$","</i>")
    				End If 
     
    				If instr(strNew,"[!") > 0 Then 
    						buffer35=split(strNew,"[!",2)
    						strNew0=buffer35(0) 
    						Response.Write (strNew0)	
    						strRemain0=buffer35(1) 		
    						buffer135=split(strRemain0,"]",2)
    						strNew1=buffer135(0) 'break it and hyperlink it
    						strRemain1=buffer135(1) 'rest 		
    						strNew0 = strNew0 + fnTxtOperate2 (strNew1, strRemain1)	
    				Else
    						 Response.Write (strNew)
    						 strRemainder = strRemainder + "!%^"
    						buffer35 = split(strRemainder,"!%^",2)
    						strNew0 = buffer35(0)
    					'Response.Write (strNew0)
    				End If		
     
    			strRemain=buffer(1) 		
    			buffer1=split(strRemain,"}",2)
    			strNew1=buffer1(0) 'break it and hyperlink it
    			strRemain1=buffer1(1) 'rest 	
    			strNew = strNew + fnTxtOperate (strNew1, strRemain1)		
    		Else
    			strRemainder = strRemainder + "!%^"
    			buffer2 = split(strRemainder,"!%^",2)
    			strNew = buffer2(0)
    			Response.Write (strNew)
    		End IF
     
    End Function			
     
     
    Function fnTxtOperate(strNew1, strRemain1) 'text extracion process for {! }
    	Dim buffer3
    	Dim buffer4
    	Dim strNew2
    	Dim strRemain2
    	Dim strTxt
    					'break	process
    				If Instr(strNew1,"|") > 0 Then
    					buffer3=split(strNew1,"|",2)
    					strNew2=buffer3(0)
    					strRemain2=buffer3(1)
    					strText="<a href ='" & strRemain2 &"\'>"& strNew2 &"</a>"
    				Else	
    					buffer3=split(strNew1,"}",2)
    					strNew2=buffer3(0)
    					strText="<a href ='" & strNew2 & "\'>"& strNew2 &"</a>"
    				End If 			
     
    				 'for bold 
    				If instr(strRemain1,"*!")> 0 Then
    					strRemain1 = Replace(strRemain1, "*!","<b>")
    					strRemain1 = Replace(strRemain1, "*","</b>")
    				End If
     
    				' for italics
    				If instr(strRemain1,"$!")> 0 Then
    					strRemain1 = Replace(strRemain1, "$!","<i>")
    					strRemain1 = Replace(strRemain1, "$","</i>")
    				End If 
     
    				Response.Write (strText)		
     
    				If instr(strRemain1,"!%^") = 0 Then 
    					fnSplit (strRemain1)	
    				End If			
    End Function
     
     
     
    Function fnTxtOperate2(strNew135, strRemain1) 'text extracion process if [! ] found
     
    	Dim buffer335
    	Dim buffer435
    	Dim strNew235
    	Dim strRemain235
    	Dim strTxt35
    					'break	process
    				If Instr(strNew135,"|") > 0 Then
    					buffer335=split(strNew135,"|",2)
    					strNew235=buffer335(0)
    					strRemain235=buffer335(1)
    					strText35="<a href ='common/default.asp?param=" & strRemain235 & "' >" & strNew235 & "</a> "
    				End If 			
     
    				Response.Write (strText35)		
     
    				If instr(strRemain1,"!%^") = 0 Then
    					fnSplit (strRemain1)	
    				End If			
    End Function
     
    %>
    <body>
    	<h3>Original Message</h3>
    	<%=strMessage%>	
    	<br /><br />
    	<h3>Parsed Message</h3>
    <%=fnSplit(strMessage)%>
    <br /><br />
    <h3>Sample Output Message</h3>
    This is a new <a href="newresearch\">Research & Developement</a> <b>assignment</b> for <a href="Sanju Shakya\">Sanju Shakya</a>. This is provided
    on <a href="common\default.asp?param=51">20080331</a>. This will <a href="Classic ASP\">be totally developed on Classic ASP</a> and nothing
    other tools. This should be done within <a href="common\default.asp?param=2">today</a>.
    </body>
    Last edited by DrBunchman; Jul 2 '08, 10:58 AM. Reason: Added code tags - Please use the # button
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    Originally posted by thesinnerishere
    i have created a program(link-generator) which is static in nature(it works correctly) meaning that this program must find the symbol { } first for it to operate properly.how can i make it dynamic so that it can be handled properly regardless of { } symbol ?
    I'm afraid I don't know how you want it to operate. Do you want it to accept user inputs?

    Jared

    Comment

    • thesinnerishere
      New Member
      • Jul 2008
      • 6

      #3
      Originally posted by jhardman
      I'm afraid I don't know how you want it to operate. Do you want it to accept user inputs?

      Jared


      actually not. the user inputs is not the vital task here. try running once the program .then Your doubt will be cleared.

      Comment

      • thesinnerishere
        New Member
        • Jul 2008
        • 6

        #4
        no concerns regarding the inputs. just try running the program once.

        Comment

        • idsanjeev
          New Member
          • Oct 2007
          • 241

          #5
          Originally posted by thesinnerishere
          no concerns regarding the inputs. just try running the program once.
          jared already asked you provide some details
          This is not a right way to posting plz follow the Rule

          Comment

          Working...