winzip icon

Advanced Dynamic File Include

Email
Submitted on: 1/7/2015 12:09:00 AM
By: Michael Tanczos (from psc cd)  
Level: Intermediate
User Rating: By 9 Users
Compatibility: ASP (Active Server Pages), HTML
Views: 2293
 
     Are you looking to do true dynamic ASP includes? I'm not talking about just printing out the contents of some other file.. or running a script through server.execute. I'm talking about actual dynamic ASP includes that allow you to include an ASP just like you would do with SSI calls. Based off of the excellent work of Don Selkirk. This contribution is my own modifications and is submitted in the spirit of open source. This is for VBScript only! If you like it take a few seconds and vote.
 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com


Other 1 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

11/12/2015 2:52:16 PMJamboz

Hello, I use this code (PART 1): <% ' **** Dynamic ASP include v.2.2 ' **** by TFI Function f(c) o="" c=r(c,"","<"&"%include(""$1"")%"&">",false) 'c=r(c,"","'Include virtual' not supported!",false) c=replace(c,"<"&"%=","<"&"%response.write ") c=replace(c,"<"&"% =","<"&"%response.write ") 'c=r(c,"<"&"% *= *","<"&"%response.write ",false) i=instr(c,"<%") j=instr(c,"%"&">") if i>0 then b=mid(c,1,i-1) b=replace(b,"""","""""") b=replace(b,vbcrlf,""""&vbcrlf&"response .write vbcrlf&""") b=vbcrlf&"response.write """&b&"""" &vbcrlf m=mid(c,i+2,(j-i-2)) a=mid(c,j+2,len(c)) o=b&m&f(a) else c=replace(c,""""," """"") c=replace(c,vbcrlf,""""&vbcrlf&"response.write vbcrlf&""") o=vbcrlf&"response.write """&c&"""" end if f=o end function
(If this comment was disrespectful, please report it.)

 
11/12/2015 2:52:37 PMJamboz

Hello, I use this code (PART 2): function r(p, s, t, v) dim objRegExp : set objRegExp = new RegExp with objRegExp .Pattern = s .IgnoreCase = v .Global = True end with r=objRegExp.replace(p, t) set objRegExp=nothing end function Function getMappedFileAsString(byVal f) Dim g,td Set g=Server.CreateObject("Scripting.FilesystemObject") Set h=g.OpenTextFile(Server.MapPath(f),1) getMappedFileAsString=h.ReadAll h.close Set h=nothing Set g=Nothing End Function Function Include(filename) executeglobal(f(getMappedFileAsString(filename))) End Function %> <% Include("included.asp") %>
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.