PDA

Click to See Complete Forum and Search --> : changing include files


artsapimp
Jul 14th, 2000, 12:51 PM
I have 3 forms with only one textarea and a submit button on each. I also have another page with three table cells. I have setup the page to populate each cell with whatever is included in my include files (option(1,2,3).inc). That is working perfectly, but now I need the forms to change the contents of each include file.

sorry if this is confusing. Please help.

The real question is how would I make whatever is typed into a textarea to change the contents of a file called option1.inc ? I'm a little lost here. Thanks.

Cerksees
Jul 14th, 2000, 12:54 PM
Have you tried using the File System Object to actually write the contents to a file "on-the-fly" (possibly generating a unique filename in the process, and send that filename to your asp to retrieve? (Don't forget to delete it after use, or you'l fill up your box.)

artsapimp
Jul 14th, 2000, 01:00 PM
I'm not good as ASP at all so any instructions would be greatly appreciated.

Cerksees
Jul 16th, 2000, 12:52 AM
I found your answer at http://www.asptoday.com/articles/19990826.htm . THIS IS NOT MY CODE......

"Use the FileSystem object to do dynamic includes
Because the web server processes include directives before it sends the page the asp.dll for further processing, you can't dynamically decide which page to include. One way around this limitation is to use the FileSystemObject and simply read the file in and write it right back out to the Response object. It's not an " include " directive, so it gets processed right along with the rest of the file in the asp.dll . So you could set up a Select statement and pick which file you wanted to pseudo-include into your response at runtime. The biggest drawback to this: Any ASP code in the file that you read in and write to the Response object will NOT be processed. So all your pseudo-include can contain is HTML code. Here's the coding for the pseudo-include (with thanks to Charles Carroll's http://www.learnASP.com site):

Sub ReadDisplayFile(FileToRead)
Dim strFilename
Dim thisfile
Dim fs
Dim strTemp

strFilename=Server.mappath(FileToRead)
Set fs = CreateObject("Scripting.FileSystemObject")
Set thisfile = fs.OpenTextFile(strFilename, 1, False)
strTemp=thisfile.readall
response.write strTemp

thisfile.Close
set thisfile=nothing
set fs=nothing

End Sub"

...but it looks awful good.

Have fun!