Announcement

Collapse
No announcement yet.

Includes across different servers

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

  • Includes across different servers

    OK, I've got the active topics working on my site and it is great, however someone else who links into my forums from another site (hence entirely different server) wants to display it on his page.

    Is there any way to do what is effectively a server side includes but on a different server?
    Motorsport Forums

  • #2
    Crude but it works!

    We ran into the same problem because our vB is on it's own domain and we wanted to include the active threads on our main domain. I wrote the following little Perl program to grab the ActiveThreads lastposts.inc file from our vB site. A cronjob is run on both domains every 15 minutes to update the ActiveThreads lastpost.inc file and transfer the latest lastposts.inc file to our main domain. The cronjob on the vB site is set to 0,15,30,45 and on the main site it's set to 2,17,32,47. So far the two min lag has worked fine.

    I would really like it if someone would come up with a way to incorporate ActiveThreads into vB postings.php. That way lastposts.inc would be updated real time each time a visitor posts and a cronjob would not be required on the vB site to update the lastposts.inc file.

    Ideally I would like to see ActiveThreads incorporated into vB with two additional templates added to vB. One template would be for the main ActiveTreads page display and the other would be for the include file.

    The way this would work is when someone posts or replies both the ActiveThreads HTML page and the ActiveThreads include file would be written to files. This way when someone viewed the ActiveThreads there would be *no* connection to the DB at all. As we all know there are far more views than posts.

    Check here for an example:
    http://www.makeitsimple.com/

    #!/usr/bin/perl
    use LWP::Simple;
    print "Content-type:text/html\n\n";

    $last_posts = get("http://mis-forums.com/vbbs/lastposts.inc");
    $inc_dir = "/your/path/to/include_dir";

    open (NEWPOSTS, ">>$inc_dir/lastposts.tmp");
    print NEWPOSTS qq|$last_posts|;
    close (NEWPOSTS);

    unlink ("$inc_dir/lastposts.inc");
    rename ("$inc_dir/lastposts.tmp", "$inc_dir/lastposts.inc");

    exit;

    A striped down copy of ActiveThreads is used to write our lastposts.inc file. If you need help with that let me know.

    Cheers!

    Larry
    Larry "NgtCrwlr" Mingus
    MakeItSimple.com | MIS-Forums.com - Building a Digital Photography Community

    Comment


    • #3
      uhh.. I may be missing something here.. but why not just use a virtual include?
      like
      virtual("http://www.domain.com/path/to/file.inc");
      Aaron
      aewebdesign

      Comment


      • #4
        Yup

        Similar to my namesakes answer you could use an include call. If your friend is running PHP simply do the following
        Code:
        <? include("http://domain.com/folder/filename.inc"); ?>
        Hope that helps.
        Aaron
        DisneySites!! MessageBoards
        http://boards.disneysites.com/

        Comment


        • #5
          There is a Catch

          You can't do the cross domain include or virtual include with .SHTML at least not on the last two hosts we have been with. We are restricted to using relative paths on .shtml includes on our server.

          After reading your posts I tried an experiment, and much to my surprise using a full URL include (across domains) does work in PHP.

          Unfortunately, this doesn't help us much because the pages that we use the includes on are old .shtml pages that have pretty good search engine placement. We are in the process of changing the entire site to PHP, but it will take quite a while before we can ditch .shtml totally.

          Thanks for the PHP tip though... this will really make things easier down the road. Sure beats the hell out of the duel cron jobs.
          Larry "NgtCrwlr" Mingus
          MakeItSimple.com | MIS-Forums.com - Building a Digital Photography Community

          Comment


          • #6
            Do you have access to your .htaccess files on the server?
            If you do, you can tell the server to parse .shtml files for php code. Thats what I did on my server so that I could use the familiar .html extension so that my users would be able to remember page addresses easier if they ever wanted to go straight to a certain page... I memorize page addresses often so that I can check back later, I don't know how many other people do this, but having familiar extensions makes the memorization process easier.

            Kinda got off topic, but it is possible to configure your server to parse your .shtml pages for php code.
            Aaron
            aewebdesign

            Comment


            • #7
              Re: There is a Catch

              Originally posted by NgtCrwlr
              [B]Unfortunately, this doesn't help us much because the pages that we use the includes on are old .shtml pages that have pretty good search engine placement
              Does php not get placed well in search engines?
              that could be a problem

              Comment


              • #8
                Thetakerfan - Nope, it's not that PHP files don't get indexed. The problem is when you change the name or extension of an existing indexed file. For example if a search engine has indexed /news/index.shtml and you change the name to /news/index.php the search engine listing will produce a 404 file not found.

                Aaron - thanks for the heads up on .htaccess parsing .shtml for PHP, I'll look into setting that up. Do you know how much if any extra overhead this causes? Also, couldn't we use .htaccess to map several of our high traffic .shtml pages to redirect to .php versions? If so is would this be a better performance solution than double parsing .shtml and .php?
                Larry "NgtCrwlr" Mingus
                MakeItSimple.com | MIS-Forums.com - Building a Digital Photography Community

                Comment


                • #9
                  ok, thanks, I didn't think it would be a problem, just got confused by your post
                  as for the htaccess stuff, I don't really know, I just use it for Directory Index and login type stuff, anyone know any where that has all the dif things you can use htaccess for?

                  Comment


                  • #10
                    Using the .htaccess file to tell your server to parse .shtml files for php would cause things to go slightly slower than if you made the changes in the apache config file, but the performance differance is negligable. If you have access to your apache config, then that would probably be the better way to go, but I wouldnt sweat using the .htaccess.

                    It is possible to use the .htaccess to redirect your .shtml pages to .php pages, and would probably help you with the transition from .shtml to .php, but just converting all of the code in your .shtml pages to php code would essentially do the same thing, it's basically just a matter of personal preferance. And about double parsing shtml and php, I would advise against mixing regular server side includes and php code in the same page.

                    Here's a link to a similar topic on the forum, it answers a lot of questions on the subject and is worth a look.
                    http://www.vbulletin.com/forum/showt...?threadid=1811

                    Feel free to contact me via email or icq if you have any questions, or just stick with the forums if ya want, I'll be checking back.

                    [Edited by Aaron on 08-10-2000 at 05:31 AM]
                    Aaron
                    aewebdesign

                    Comment

                    widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                    Working...
                    X