Dynamic Includes

Dynamic Includes

How can I do a dynamic include, such as:

However, I think I know why this doesn’t work– because includes are tossed in before it goes to the parser (asp.dll). But if that’s the case, why is it? I seem to have tried every possible combination trying to get this to work, to no avail.

You are right: it can’t be done. But there is a workaround, if you can live with it. Simply use a large Select Case statement:
<%Select Case varfilename Case "value1"%><% Case "value2"%><%
… and so on …
%><%End Select%>
Be very careful about placing the <% and %> tags, though.

See also  How to Block Websites During Certain Hours on a Mac Computer

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist