How to point to other URL's with #include command?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Viken Karaguesian

    How to point to other URL's with #include command?

    Hello all,

    I've used the SSI Include command successfully in the past to include
    frequently used files that are based within my own site. However, what
    if I was to use a file located in a differnt location - a different
    site altogether?

    I've Googled different variations of "how to insert an URL using
    #include" but all of the sites that came up never got beyond "file="
    and "virtual=". There may be no more to it that that, but I'm not
    sure.

    I've tried <!--#include file="http://blahblahblah.co m/filename.txt" -->
    and other variations of that using CSS style "url('')" and "a href=",
    but have gotten nowhere. Can this be done with the #include command? If
    so, how?

    The intended use is: I have someone who wants to add a schedule to a
    website. The schedule will change frequently, causing a major hassle
    for me. Ideally, I would have that person upload the file to their own
    folder on the internet, and I would link to that file with the include
    command, displaying the contents on the web page.

    Thanks in advance.

    Viken K.

  • Harlan Messinger

    #2
    Re: How to point to other URL's with #include command?

    Viken Karaguesian wrote:[color=blue]
    > Hello all,
    >
    > I've used the SSI Include command successfully in the past to include
    > frequently used files that are based within my own site. However, what
    > if I was to use a file located in a differnt location - a different
    > site altogether?
    >
    > I've Googled different variations of "how to insert an URL using
    > #include" but all of the sites that came up never got beyond "file="
    > and "virtual=". There may be no more to it that that, but I'm not
    > sure.
    >
    > I've tried <!--#include file="http://blahblahblah.co m/filename.txt" -->
    > and other variations of that using CSS style "url('')" and "a href=",
    > but have gotten nowhere. Can this be done with the #include command? If
    > so, how?[/color]

    No. The #include directive reads a file, it doesn't request a document
    over the web. The server would also have to be a web client! So the
    #include directive doesn't have that functionality.

    If you're using ASP under IIS, you can use the WinHTTPServerRe quest
    ActiveX object to request the off-site page through code and write the
    data returned out to the client. Other server-side technologies on other
    web servers might provide a similar facility.

    Comment

    • Viken Karaguesian

      #3
      Re: How to point to other URL's with #include command?

      > No. The #include directive reads a file, it doesn't request a document[color=blue]
      > over the web. The server would also have to be a web client! So the
      > #include directive doesn't have that functionality.[/color]


      Thanks Harlan. I've searched page after page in Google and hadn't found
      any references to that, so I was coming to that conclusion on my own.

      An better solution would be to provide her with a folder on the
      webhost's server, give her a user name and password and have her copy
      the file to that folder. Then I can link to the file from within the
      site.

      Don't know why I didn't think of that before...

      Thanks for the reply.

      Viken K.

      Comment

      • Andy Dingley

        #4
        Re: How to point to other URL's with #include command?

        On 31 Jan 2006 10:10:05 -0800, "Viken Karaguesian" <vikenk@aol.com >
        wrote:
        [color=blue]
        >I've used the SSI Include command successfully in the past to include
        >frequently used files that are based within my own site. However, what
        >if I was to use a file located in a differnt location - a different
        >site altogether?[/color]

        It doesn't (stretching a point) have to be a file on the same _site_,
        but it must be on the same filesystem that the web server uses.

        Files, and especially include files, are quite a low-level part of the
        web architecture and they're tightly coupled to how the server operates.
        It should not have to read them every time the page is served, but it
        must be able to tell when they've been changed (so it can include the
        new version). Generally a good server will do the merging once, then
        cache the merged copy until something changes.

        So if you separate the web server from its include files, then you're
        making life very difficult for the server. This is why you can only
        process includes from a "file" attribute or a "virtual" attribute which
        maps onto a local file, but there's no "web address" or "href"
        attribute.

        There are several options for you.

        * <iframe>
        This is the closest to "include files over the web", but it's done on
        the client (web browser) side. It has drawbacks. You'll also need the
        content author to have their own full-powered web hosting.

        * Upload to your server.
        Have the author make the file on their desktop machine, then upload it
        (by ftp, or more sophisticated means) to your web server. Good hosting
        packages allow you to create restricted ftp accounts that only access
        subdirectories, which are ideal for this. This is probably the best
        solution.

        * Weblog
        Install some simple weblogging software on your server, configure it to
        turn nearly all features off, then let the content author be the one
        user who can make postings to it. This is a good solution if the
        content author is not technically expert - remember that an error in
        their content might break a lot of your site!

        [color=blue]
        >Ideally, I would have that person upload the file to their own
        >folder on the internet, and I would link to that file with the include
        >command, displaying the contents on the web page.[/color]

        What's a "folder on the internet" ? Do they have web hosting of their
        own, and does it have adequate capacity for this purpose ? If they can
        upload to "their folder", then they can probably upload to a directory
        on your server just as easily.

        Comment

        • Viken Karaguesian

          #5
          Re: How to point to other URL's with #include command?

          > * Upload to your server.[color=blue]
          > Have the author make the file on their desktop machine, then upload it
          > (by ftp, or more sophisticated means) to your web server. Good hosting
          > packages allow you to create restricted ftp accounts that only access
          > subdirectories, which are ideal for this. This is probably the best
          > solution.[/color]

          This is exactly what I plan to do. I don't know why I didn't think of
          it before. See my reply to Harlan.
          [color=blue]
          > What's a "folder on the internet" ? Do they have web hosting of their
          > own, and does it have adequate capacity for this purpose ?[/color]

          Many ISP's, like mine (Comcast) offer "personal web spaces" with their
          accounts. This is a folder that you can put a website in or just put
          files for you and others to access. She has Comcast, so she as a folder
          to which she can upload. But the previously mentioned solution is
          better.

          Thanks.

          Viken K.

          Comment

          • Nick Kew

            #6
            Re: How to point to other URL's with #include command?

            Viken Karaguesian wrote:[color=blue]
            > Hello all,
            >
            > I've used the SSI Include command successfully in the past to include
            > frequently used files that are based within my own site. However, what
            > if I was to use a file located in a differnt location - a different
            > site altogether?
            >
            > I've Googled different variations of "how to insert an URL using
            > #include" but all of the sites that came up never got beyond "file="
            > and "virtual=". There may be no more to it that that, but I'm not
            > sure.[/color]

            There are ways to do that. In Apache, mod_publisher gives you
            <!--#include url="..."-->. Or an ESI processor will do an
            essentially-equivalent job.

            Whatever you use, make sure you have some sensible cacheing
            regime on your server, so you're not fetching something by HTTP
            on every hit.

            --
            Nick Kew

            Comment

            Working...