Is it possible to imbed SSI statements within logic?

Results 1 to 3 of 3

Thread: Is it possible to imbed SSI statements within logic?

  1. #1
    Join Date
    Dec 1969
    Posts
    1,324

    Default Is it possible to imbed SSI statements within logic?

    I am assembling a number of ASP pages and need to change the navigation bar and border depending on the location of the page. I have tried VB SCript and JScript but haven&#039t been able to achieve a &#039include inside a switch or if statement. Is it possible and does anyone know how?

  2. #2
    Ian Stallings Guest

    Default RE: Is it possible to imbed SSI statements within logic?

    Yes this is possible<BR><BR>&#060;%<BR>if request.form("whatever") = "whatever" then<BR>response.write "&#060;!--#INCLUDE FILE=&#039includefilehere.asp&#039--><BR>else<BR>response.write "&#060;!--#INCLUDE VIRTUAL=&#039/includes/include.asp&#039--><BR>end if<BR>&#037;&#062;<BR><BR>If you have more than a few option then you may want to<BR>use the filesystem object to read an include file then write it<BR>to the page based on whatever variable or statement.<BR><BR>like so:<BR><BR>&#060;%<BR>File = request.querystring("file")<BR>IncludeFile = server.mapPath(File)<BR>Set fs=Server.CreateObject("Scripting.FileSystemObject ")<BR>IF fs.FileExists(IncludeFile) THEN<BR>set f = fs.openTextFile(IncludeFile)<BR>content = f.readall<BR>set f = nothing <BR>set fs = nothing <BR>response.write(content)<BR><BR>End if<BR>&#037;&#062;<BR><BR>I hope this helps you.<BR><BR>Ian

  3. #3
    Steve Evans Guest

    Default RE: Is it possible to imbed SSI statements within logic?

    Many thanks, Ian, problem solved :o)

Posting Permissions

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