ASP Includes
- Started
- Last post
- 7 Responses
- seed
Anyone know how to use a variable to generate a dynamic filename in an include without getting an error. Hopefully without using Select Case as my list of includes is getting too large or without having to resort to this lengthy example.
http://www.asp101.com/articles/m…
Should be simple but apparently in ASP 'the include directives are resolved before the server-side script portions are processed' so you get an error trying to use variables in the names.
- QuincyArcher0
I tried this one...and ended up resorting to a select case statement...
- seed0
It's pretty lame how difficult it is to make them dynamic. I will have hundreds of includes eventually.
- QuincyArcher0
hundreds? then i would suggest storing the content in a database...
- seed0
I am building a wireframe and hoped to be able to just add the includes by having the page names in the query string and passing them to the include name. I might have to do make a simple db. I didn't realize how many pages I would have until yesterday.
- seed0
I found some info on how you can use:
Server.Execute(view_file)
view_file being the variable name with IIS 5. I am getting a 'The call to Server.Execute failed while loading the page'. Anyone have an idea why?
- seed0
It works I had the path wrong in the variable. QuincyArcher, there is a solution for you in the future.
- QuincyArcher0
thanks, i'll keep that in mind next time i need to do this.