SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    ********* Addict DLG_1's Avatar
    Join Date
    Jun 2000
    Location
    Texas, USA
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Plain ASP Include, no SSI

    can someone help? I'm trying to include a plain html file in my asp page, but don't know how to include since SSI is deactivated(?)


    regards,
    dlg

  2. #2
    SitePoint Wizard big_al's Avatar
    Join Date
    May 2000
    Location
    Victoria, Australia
    Posts
    1,661
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I wasn't aware that you can disable the include function in ASP. You can disable the shtml extensions though.

    if you put this in your ASP file it should do the trick.

    [VBS]<!-- #Include File="Path/FileName.asp" -->[/VBS]

    Hope this helps
    .NET Code Monkey

  3. #3
    SitePoint Addict
    Join Date
    Aug 2000
    Posts
    248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well if SSI is deactivated you can try this:
    Code:
    <% ' Display the contents of another FILE without SSI
          'FIRST TELL HTE SERVER WHERE THE FILE IS YOU WANT TO INCLUDE
    
          infil = server.MapPath("FILETOINCLUDE.HTML")
    
          'THIS IF THEN STATEMENT IS NOT REALLY NECESSARY IF YOU HANDCODE THE PATH LIKE I DID ABOVE. 
          'HOWEVER YOU MIGHT NEED IT IF YOU WANT TO MAKE THE INCLUDE DYNAMIC BY PULLING THAT FILE VALUE FROM A DATABASE 
      
          If infil <>"" then
    
             set fso = Server.CreateObject("Scripting.FileSystemObject")
             set fil = fso.OpenTextFile(infil)
    
             outstring = fil.ReadAll
    
             ' PRE tags preserve the format of the file
    
             Response.write "<PRE>" & outstring & "</PRE><BR>"
    
          End If
       %>
    BASICALLY YOU ARE USING FSO TO READ AND THEN PRINT OUT THE CONTENTS OF YOUR HTML FILE.
    NOTE: ANY ASP CODE IN THE INCLUDE FILE (FILETOINCLUDE.HTML) WILL NOT BE PROCESSED!!!!!!!!!!!!!!!!!!!!!!!!!!
    ONLY ASP CODE IN THE FILE DOING THE INCLUDING WILL PROCESS ASP CODE.

    HTH
    Last edited by alexming; Mar 20, 2002 at 16:33.

  4. #4
    ********* Addict DLG_1's Avatar
    Join Date
    Jun 2000
    Location
    Texas, USA
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    Active Server Pages error 'ASP 0126' 
    
    Include file not found 
    
    /ccmanagement/Default.asp, line 15 
    
    The include file 'http://chlweb/ccmanagement/assets/header.htm' was not found.
    THIS IS THE ERROR THAT I GET.
    THIS IS MY INCLUDE:
    <!--#include file ="http://chlweb/ccmanagement/assets/header.htm" -->


    ON AN INTRANET

  5. #5
    SitePoint Addict
    Join Date
    Aug 2000
    Posts
    248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can't use the http:// in an include. You have to use a relative path.

    <!--#include VIRTUAL ="/chlweb/ccmanagement/assets/header.htm" -->

    or if the file is in the same directory where you are calling the include from then use:

    <!--#include FILE ="header.htm" -->



    Notice the difference:

    FILE in one and VIRTUAL in the other.


    HTH

  6. #6
    ********* Addict DLG_1's Avatar
    Join Date
    Jun 2000
    Location
    Texas, USA
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Active Server Pages error 'ASP 0126'

    Include file not found

    /ccmanagement/Default.asp, line 15

    The include file 'chlweb/ccmanagement/assets/header.htm' was not found.


    and when I do:

    /chlweb/ccmanagement/assets/header.htm

    it says:

    it doesn't like the leading forward slash...

    what gives?

  7. #7
    SitePoint Addict
    Join Date
    Aug 2000
    Posts
    248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's kind of hard to tell you where your file is without knowing the directory structure on the server.


    Look here http://www.useforesite.com/tut_ssi.shtml towards the bottom and it might shed some light on the subject for you.


    If it doesn't then come back and give us your directory structure (where the file is that you are trying to include and where the file is located that is doing the include).



    HTH
    Last edited by alexming; Mar 20, 2002 at 16:55.


Bookmarks

Posting Permissions

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