Guest Lester Posted May 18, 2007 Share Posted May 18, 2007 I have an situation where a user has access to simple data files in a folder which they can edit on the fly. These are text content files for a "news" feature and I'd like to be able to pull them into a template file with an include statement.So we are faced with the old problem that you cannot place an ASP variable inside an Include Statement.ie. great if we could do this....<% fname="header.inc" %><!--#include file="<%=fname%>"-->Is there some way that the Include File statement could be built up as a text string and then executed as such without having to restate the variable.thanks .les. Link to comment Share on other sites More sharing options...
Yahweh Posted May 18, 2007 Share Posted May 18, 2007 I have an situation where a user has access to simple data files in a folder which they can edit on the fly. These are text content files for a "news" feature and I'd like to be able to pull them into a template file with an include statement.So we are faced with the old problem that you cannot place an ASP variable inside an Include Statement.ie. great if we could do this....<% fname="header.inc" %><!--#include file="<%=fname%>"-->Is there some way that the Include File statement could be built up as a text string and then executed as such without having to restate the variable.thanks .les. <%dim fnamefname = "header.asp"Server.Execute(fname)'remainder of page content goes here%> Or optionally, dim fnamefname = "some query"Server.Execute("page.asp?q=" & fname) Server.Execute is not the same as an include file. An include basically pastes code from file file into another, then it executes all of that code inline as if it were one piece.Server.Execute doesn't work like that. It literally forces the server the make a new page request, then it copies the page output from that page request into your original page. That means you can't share variables between pages when you use Server.Execute. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.