Announcement

Collapse
No announcement yet.

SSI Question: Calling Content

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • SSI Question: Calling Content

    Hi group,

    I'm wondering if it's possible, using the standard SSI routine, to call the content (in this case a text file) from another web site?

    The scenario is a domain (a state) with several sub-domains (counties) with each site needing to show names of office holders, which of course change on a regular basis.

    If these names could be updated only in a .inc file on the top level domain, this would make life a lot easier.

    I thank you for any advice.

    Leon

  • #2
    You can call a file on your site say a .py file which would load the data from another site

    <!--#include virtual="test.py" -->

    Comment


    • #3
      Originally posted by fiveworlds View Post
      You can call a file on your site say a .py file which would load the data from another site

      <!--#include virtual="test.py" -->
      Thanks for the reply fiveworlds but I'm afraid I'm not familiar with the solution. Any coaching you can provide would be greatly appreciated.

      Cheers,

      Leon

      Comment


      • #4
        You make the file test.py with the following.

        #!/path_to_python.exe
        import sys
        import urllib2
        print "Content-type: text/html"
        print
        print "<html><head>"
        print "</head><body>"


        target_url = "https://wordpress.org/plugins/about/readme.txt"
        for line in urllib2.urlopen(target_url):
        print line

        print "</body></html>"

        Comment


        • #5
          Without using Python, you can still use SSI, test.html will have the list of office holders, you can even name the file the county name.html

          <!--#include virtual="test.html" -->

          Just add that in place where you want them to show, I used html as you can format it better.

          HTML Code:
          <html>
          <body>
          <some html code here>
          
          <!--#include virtual="test.html" -->
          
          </body>
          </html>
          Now, the main page that will run this code should be .shtml, as most servers know what that is.
          Have a Script or Snippet you want to share?

          WWW Standards: HTML 4.01,
          HTML 5, CSS2.1, CSS3, XHTML 1.0
          PHP Standards: PHP Standards

          Comment

          Working...
          X