The problem with the conditional
SSI approach is that before the page is parsed by the
ASP engine, all of the included scripts are built into the one page to be parsed - so you've got one BIG file being parsed just for some if then statements.
One other solution is to use the server.execute method. Which will include the results of just the file you need. Simple and better preformance. For example:
- Code: Select all
<html>
...
<body>
...
<% server.execute("page" & n & ".asp") %>
</body></html>
Another option is to create a "template" with placeholders, which you then replace with the content code. For example:
- Code: Select all
one file contains:
<html>
...
<body>
...
##Content##
</body></html>
Then your script reads in that file, and does a string replace of ##Content## with the contents of Page1.
asp for example - and then it writes the results of the replacement out to the browser. This method allows you to build the template without having any
ASP code in it, so it's easily manipulated by
WYSIWYG editors and easy to preview what your end page will look like.