Results 1 to 23 of 23

Thread: Serverside Scripting and the include function

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Posts
    207

    Serverside Scripting and the include function

    Ok,

    I am having a little bit of trouble. I am unable to get the include function to work. I am running IIS 5, should this still work. Any assistance in the matter is much appreciated.

    Jeremy

  2. #2
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404
    what error messages are you getting?

    and how are you calling them?

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Posts
    207

    Error

    I am not getting an error on the server or the client, the included pages simply does not display.

    Any ideas?

  4. #4
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404
    Make sure that

    1. The file that has the includes in has the extension .shtml
    2. The files you are including have the extension .html

    If the above two have been done then it is your server that is incorrectly configured!

    View source on the page and look if the
    include line:

    <!--#include virtual="your file.html"-->

    is there.

    if it is then it is not being interpreted by the server.(Check your server config!!)

    This should help!

  5. #5
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    Wow... I'm using .inc for included file extensions. It is working on every machine we've tried it on save one, and that one is running ASD.
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  6. #6
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404
    ASD ??

    I don't think it matters what the included file is called i just said .html as an example cos i know that works!

  7. #7
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    SSI shouldn't care what file extension you use for include files.
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

  8. #8
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404
    thought as much!

  9. #9
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    ASD = Active Server Directory

    We get permissions errors when an ASP tries to include a file that is in the same directory. It is only on that machine, and that machine is the only one running ASD. I don't have a clue what the problem is.
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Posts
    207

    Ok

    Ok if I use the extesion of shtml it works, is there anyway I can have this work for htm or html files?

    Jeremy

  11. #11
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404

    Arrow

    I've never heard of that technology (ASD) so i wouldn't have a clue m8

    sorry!


  12. #12
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404

    Wink

    you would have to change your servers config so that the extension(s) (.htm, .html) are associated with SSI,

    This would slow down every .htm, .html file you have on that server as they would all be pre-processed by the server regardless of whether they contain includes or not.

    So i wouldn't bother if i where you

  13. #13

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Posts
    207

    Humm

    Really don't have much of a choice, do you know where I can change these options?

    Jeremy
    Last edited by Jeremy Martin; Nov 7th, 2001 at 11:25 AM.

  14. #14
    scoutt
    Guest
    I too wouldn't do that. changing it so every htm or html extension is parsed as SSI will slow things down considerably, and/or might have troubles with that as well.

    the file doing the include has to be .shtml and you can include anything like .inc or .txt or .html, that shouldn't matter.

    but changing it will make the server work twice as hard.

    why wouldn't you not have a choice?? it is easier to leave it as is and make the extension as .shtml. also if it is an ISP you might not be able to do that.

    just my 2 cents

  15. #15
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404
    to change the extension .html to be associated with SSI

    1. go into control panel/computer management
    2. find and expand the internet information services tree
    3. right click on the website you wish to change the extensions on
    4. click the home directory tab
    5. click the configuration button
    6. you will then see a list of extensions and there associated executables & dll's

    from here you can edit them !

    Don't take this as gospel but server side include technology isn't a very secure technology.

    If you wish to templatise your pages you can use javascript templates. for example if you have a header that you want included on every page you can put it in a js file and do the following

    Code:
    #js file header.js
    var header = "";
    header+="<h1>my included javascript header</h1>";
    
    #html page home.html
    <html>
    <head>
    <script language="javascript" src="header.js"></script>
    </head>
    <body>
    <script language="javascript">document.write(header)<script>
    <h2>my content</h2>
    </body>
    <html>
    This is a method i use on a regular bases, it can also be quite fast as the first time the js file is used by a user it is cached on there machine so for the rest of the site the html will be loaded in faster.

    This method should be quicker than SSI as it is a clientside technology which is usually quicker than server side, and it won't slow your server down, and you can keep your pages with the .html extension!

    Well there u go now you have two choices!

    I recommend you give the js way a try before changing you server extensions

  16. #16
    scoutt
    Guest
    thanks progressive, never thought about doing it that way, engenious man purely engenious.

  17. #17
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404
    no probs !

  18. #18

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Posts
    207

    JS Header

    I was going to use the JavaScript header to display the header but the only problem is the page call a javascript function and has both types of quotes in it '," so that when I do a document.write the script is incomplete because the ' or the " terminates the string of the write function. I am really not to concerned with security as this site does not have a confidetial or secure information on it.

    Jeremy

  19. #19
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    Code:
    <script type="text/javascript">
      document.writeln("I'm a JavaScript that can write \"s.  Aren't I special?");
    </script>
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

  20. #20
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404
    Thats easy all you need to do is escape the ' by putting \ infront of it

    see the attachment!

  21. #21

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Posts
    207

    True

    This is true, the only problem is this header is a adobe golive document that has serveral floating text boxes and uses style sheets. When all is said and done this document is a lot of lines and to write the document as a javascript and reformat all the strings everytime something is updated would be an extrodinary job within its self. I was going to use the shared boarder option in FrontPage but frontpage doesn't handel all the dhtml correctly and rewrite the top boarder and then all kinds of script error occurs.

    Jeremy

  22. #22
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404

    Arrow

    Dreamwever uses library's to allow you to templatise your page.
    you can have a page with content on and include a header and footer library etc..

    All the html is in the one page, but dreamever knows that if you change something in the header or footer library it has to update the page.

    This then leaves you with a complete html page which you can upload!

    Thats a pretty flakey description but one worth looking into

    Oh well you seem to know what your doing so i'll let you decide what you want to do.

  23. #23

    Thread Starter
    Addicted Member
    Join Date
    Jul 1999
    Posts
    207

    HTML Software

    Humm, that sounds pretty neat but I am restricted to FrontPage and GoLive because that is what is covered under out campus agreement.

    Jeremy

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