<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>John Wells &#187; ASP Classic</title>
	<atom:link href="http://www.jfwhome.com/tag/asp-classic/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jfwhome.com</link>
	<description>Knowledge Management and Social Web App Guru</description>
	<lastBuildDate>Mon, 04 Jan 2016 17:26:35 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.9</generator>
	<item>
		<title>Simple dynamic ASP includes</title>
		<link>http://www.jfwhome.com/2009/06/19/simple-dynamic-asp-includes/</link>
		<comments>http://www.jfwhome.com/2009/06/19/simple-dynamic-asp-includes/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 14:10:21 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[ASP Classic]]></category>
		<category><![CDATA[Solutions]]></category>

		<guid isPermaLink="false">http://www.jfwhome.com/?p=7</guid>
		<description><![CDATA[I always end up never quite believing it when, once again, it dawns on me that I can&#8217;t complete a project the way I visualise due to ASP Classic&#8217;s lack of support for dynamic includes. This time, I was creating a CMS-like site, which included mixed HTML/ASP files automatically. I tried pretty much every other&#8230;]]></description>
				<content:encoded><![CDATA[<p>I always end up never quite believing it when, once again, it dawns on me that I can&#8217;t complete a project the way I visualise due to ASP Classic&#8217;s lack of support for dynamic includes. </p>
<p>This time, I was creating a CMS-like site, which included mixed HTML/ASP files automatically. I tried pretty much every other solution &#8212; including server.execute (no go &#8212; doesn&#8217;t preserve variables/functions),  and other examples of using ASP&#8217;s execute() command to parse files (didn&#8217;t work for mixed HTML/ASP).</p>
<p>So, the only thing left was to write my own. It&#8217;s fairly simple, and due to ASP/VBScript&#8217;s horribly limited feature set, very low-level. It steps through a file one character at a time, and decides if it is in &#8220;HTML mode&#8221; or &#8220;ASP mode&#8221; at an given time, and then uses this staus to convert the file into a set of executable lines.</p>
<p>It should handle most things correctly, with the exception of defines, and <code>&lt;!--#</code> -style directives. It handles short ASP write tags (<code>&lt;%= %&gt;</code>) just fine. Variable scope is preserved inside the include file, and variables/functions set inside the include file continue to exist outside it after it is included &#8212; in other words, just as they should.</p>
<p>To use it, simply include the file, and use it just as you would in a sane language:</p>
<p><code>include("relative_path_to_local_file.asp")</code></p>
<p>The function returns false if the file doesn&#8217;t exist, or true otherwise.</p>
<p>If you fix any bugs in this, please let me have them.</p>
<p>Download it here: <a href="http://www.jfwhome.com/wp-content/uploads/2009/06/asp-simple-include.zip">ASP Dynamic Includes</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jfwhome.com/2009/06/19/simple-dynamic-asp-includes/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
