Quick Search for:  in language:    
class,allows,dynamic,include,file,into,your,s
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
ASP/ VbScript Stats

 Code: 196,174. lines
 Jobs: 103. postings

 How to support the site

 
Sponsored by:

 
You are in:
 

Does your code think in ink?
Login


 

 


Latest Code Ticker for ASP/ VbScript.
Server Side PDF
By Igor Krupitsky on 11/20


Click here to see a screenshot of this code!Multiple Web Sites on one IP
By Richard J Mackey on 11/20

(Screen Shot)

Click here to see a screenshot of this code!Multiple websites on One IP
By Richard J Mackey on 11/20

(Screen Shot)

Click here to see a screenshot of this code!Combo-Box with Auto-Complete
By Mark Kahn on 11/18

(Screen Shot)

Click here to see a screenshot of this code!RegEx pattern match in VBScript
By moppy on 11/18

(Screen Shot)

Click here to see a screenshot of this code!Text-to-Speech in MS Outlook
By Nick Sumner on 11/18

(Screen Shot)

Click here to see a screenshot of this code!Rapid Classified Board v1.0 (beta)
By Gurgen Alaverdian on 11/17

(Screen Shot)

Adjust a GIF's Hue/Sat/Lum
By Mark Kahn on 11/17


Search Engine
By vsim on 11/17


Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!

Affiliate Sites



 
 
   

Dynamic File Includes v2.1

Print
Email
 

Submitted on: 7/1/2002 10:24:05 AM
By: dselkirk 
Level: Advanced
User Rating: By 7 Users
Compatibility:ASP (Active Server Pages)

Users have accessed this article 3958 times.
 
(About the author)
 
     This class allows you to dynamic include a file into your script. Please vote and give me some feed back.

This article has accompanying files
 
 
Terms of Agreement:   
By using this article, you agree to the following terms...   
1) You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.

New Features
• processed html as variables instead of strings. No processing for special characters is required.

Purpose
I, as like most ASP developers have wanted the ability to dynamically include script files. If dynamic includes were possible we would be able to increase performance if existing code, add files based upon a variable value and even change the structure of page creation. The possibilities are enormous.

Basics
The function is actually very simple. It reads the passed file using the filesystem object. Then it removes the surrounding ASP delimiters "<% ... %>". This allows us to re-use existing files. The files contents are then passed through the vbscript method "ExecuteGlobal". This will stick the content into the current process and give us access to it. Below is an example of how to include a file.

<!--#include file="include.asp"-->
<%
  include "file1.asp"
  output "procedure called output located in file1.asp"
%>

Limitation
This class will not support vbscript statements like "Option Explicit" or "<%@ ... %>".

Conclusion
I really hope that you find this as useful as I have. I would appreciate any comments or suggestions for future version to increase performance and robustness. I would also appreciate you votes.

Future
Stay tuned for version 3. Implementing an entire website from a database. (it's already done, just have to find time to package it up)

winzip iconDownload article

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

 
Terms of Agreement:   
By using this article, you agree to the following terms...   
1) You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.


Other 9 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this article(in the Advanced category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
7/30/2002 3:44:26 AM:Johan
It takes exceptionally long to execute "complecated" includes...then it times out
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
7/30/2002 8:38:19 AM:Don
You have to remember what it's doing. What do you meean by complicated?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/22/2002 4:09:58 PM:Greg A
It works great...almost! I've found at least one bug. It seems to strip out pipes from the HTML that's being included.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
8/22/2002 10:54:42 PM:Don
I use the pipes as delimiters for parsing. You can change this in the convert2code function of the include.asp file.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/24/2002 6:46:14 AM:
Give Me this error : Error Type: Microsoft VBScript compilation (0x800A03EA) Syntax error /includes/include.asp, line 5 class cls_include anyone can help ?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
10/24/2002 8:56:32 AM:Don
i'm not sure but from what i can see I made a small typo. where it says arr_variables.removeall should be include_vars.removeall. give that a try.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
1/31/2003 2:32:45 PM:
This code works great! it's just what I've been looking for to allow users to create their own templates and upload them. Thanks so much, Don!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
2/26/2003 11:32:03 AM:
This code save my life ;DD Thanks soooo much!!!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
3/3/2003 10:52:27 PM:
Works great! I had wrestled with this problem today and came up with the same solution .. but you already coded it up. Thanks fo rthe time saver.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
4/5/2003 2:07:25 PM:
I have been using this code for a while now and forgot where I got it. I'm glad to finally give you 5 for it! I am using it for a dynamic web site that has the asp files stored in the database. Phred
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
11/18/2003 12:45:02 PM:
I'me getting Error Type: Erro de compilação do Microsoft VBScript (0x800A0409) Constante de cadeia não terminada /outboundrecords/classes/clsI nclude.asp, line 29 Any Help
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this article has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular article, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | ASP/ VbScript Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.