Results 1 to 4 of 4

Thread: changing include files

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2000
    Posts
    323
    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.
    If you think education is expensive, try ignorance.

  2. #2
    Junior Member
    Join Date
    Jul 2000
    Location
    Posts
    28

    Talking Tried FSO?

    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.)

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2000
    Posts
    323
    I'm not good as ASP at all so any instructions would be greatly appreciated.
    If you think education is expensive, try ignorance.

  4. #4
    Junior Member
    Join Date
    Jul 2000
    Location
    Posts
    28

    Talking Sorry it took so long...

    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width