|
|
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) | |
Download 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 |
|
|
Your Vote! |
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
|
7/30/2002 8:38:19 AM:Don You have to remember what it's doing.
What do you meean by complicated?
|
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.
|
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.
|
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
?
|
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.
|
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!
|
2/26/2003 11:32:03 AM: This code save my life ;DD
Thanks
soooo much!!!
|
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.
|
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
|
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
|
|
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. |
|