Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: How to include from one file?

  1. #1
    Aquarezz's Avatar
    Aquarezz is offline Master Net Builder
    Join Date
    Dec 2008
    Location
    Belgium
    Posts
    3,853
    Blog Entries
    4
    Thanks
    683
    Thanked 591 Times in 463 Posts

    How to include from one file?

    Hi,
    Is it possible to do the following.. So from one site to another or to file on server...

    Like this:
    PHP Code:
    <?php include "http://site.com/file.php"?>
    Or:
    PHP Code:
    <?php include "public_html/file.php"?>
    So that I only need to update one file instead of 3 zillion?


    Greetz
    |Nico Lawsons

  2. #2
    Rizy is offline Newbie Net Builder
    Join Date
    Mar 2009
    Posts
    42
    Thanks
    0
    Thanked 7 Times in 5 Posts
    Yes, for example I use:

    Code:
    <? include("/www/dynamic/title.txt"); ?>
    which - if I want to add some kind of huge thing to my title tag in a month or something it's no problem.

  3. #3
    Aquarezz's Avatar
    Aquarezz is offline Master Net Builder
    Join Date
    Dec 2008
    Location
    Belgium
    Posts
    3,853
    Blog Entries
    4
    Thanks
    683
    Thanked 591 Times in 463 Posts
    Quote Originally Posted by Rizy View Post
    Yes, for example I use:

    Code:
    <? include("/www/dynamic/title.txt"); ?>
    which - if I want to add some kind of huge thing to my title tag in a month or something it's no problem.
    Great, so <? include("/public_html/topsites.php"); ?> should work?

    Greetz
    |Nico Lawsons

  4. #4
    Rizy is offline Newbie Net Builder
    Join Date
    Mar 2009
    Posts
    42
    Thanks
    0
    Thanked 7 Times in 5 Posts
    Quote Originally Posted by Aquarezz View Post
    Great, so <? include("/public_html/topsites.php"); ?> should work?

    Greetz
    Probably going to need to do the full dir, /home/user/public_html/topsites.php - as how you said would make it more dependent where your including from since it's not the full dir.

  5. #5
    Aquarezz's Avatar
    Aquarezz is offline Master Net Builder
    Join Date
    Dec 2008
    Location
    Belgium
    Posts
    3,853
    Blog Entries
    4
    Thanks
    683
    Thanked 591 Times in 463 Posts
    Alright, thanks a lot!

    Greetz
    |Nico Lawsons

  6. #6
    Charles's Avatar
    Charles is offline Senior Net Builder
    Join Date
    Dec 2008
    Location
    On the Bike
    Posts
    1,211
    Blog Entries
    5
    Thanks
    311
    Thanked 311 Times in 212 Posts
    If you're using add-on domains... You can use the following:
    PHP Code:
    <? include("../topsites.php"); ?>
    The ".." means to go up one directory.

  7. #7
    coows is offline Newbie Net Builder
    Join Date
    Mar 2009
    Posts
    31
    Thanks
    2
    Thanked 2 Times in 1 Post
    Charles,
    Yes that is correct and to go one step further if you are pulling everything from another Add on domain.

    <?php
    include ('/home/YOURMAINDIR/public_html/YOURDOMAIN.COM/includes/fb.php');

    Where YourDomain.com is going to be the add on you are pulling it from..


    Quote Originally Posted by Charles View Post
    If you're using add-on domains... You can use the following:
    PHP Code:
    <? include("../topsites.php"); ?>
    The ".." means to go up one directory.

  8. #8
    Charles's Avatar
    Charles is offline Senior Net Builder
    Join Date
    Dec 2008
    Location
    On the Bike
    Posts
    1,211
    Blog Entries
    5
    Thanks
    311
    Thanked 311 Times in 212 Posts
    Quote Originally Posted by coows View Post
    /home/YOURMAINDIR/public_html/
    You shouldn't actually need that part. You would only need to include the full path, if you were to have a '/' before the add-on domain folder.
    PHP Code:
    <?php include("YOURDOMAIN.COM/includes/fb.php"); ?>
    That should work equally well.

  9. #9
    coows is offline Newbie Net Builder
    Join Date
    Mar 2009
    Posts
    31
    Thanks
    2
    Thanked 2 Times in 1 Post
    I gotcha.......
    Quote Originally Posted by Charles View Post
    You shouldn't actually need that part. You would only need to include the full path, if you were to have a '/' before the add-on domain folder.
    PHP Code:
    <?php include("YOURDOMAIN.COM/includes/fb.php"); ?>
    That should work equally well.

  10. #10
    Will.Spencer's Avatar
    Will.Spencer is offline Retired
    Join Date
    Dec 2008
    Posts
    5,033
    Blog Entries
    1
    Thanks
    1,010
    Thanked 2,329 Times in 1,259 Posts
    If your host has allow_url_open and allow_url_include enabled in php.ini, you can even do this:
    Code:
    include 'http://www.example.com/file.php';
    Unfortunately, those settings are somewhat unpopular due to the number of Remote File Inclusion exploits.
    Submit Your Webmaster Related Sites to the NB Directory
    I swear, by my life and my love of it, that I will never live for the sake of another man, nor ask another man to live for mine.

Page 1 of 2 12 LastLast

Similar Threads

  1. How i include a table in multiple sites?
    By sooraj in forum Web Design
    Replies: 5
    Last Post: 7 November, 2012, 09:15 AM
  2. [WTS] PR1 File Mirror Site - Upload to 15 File Hosts
    By ChaoscripT in forum Sites
    Replies: 0
    Last Post: 26 September, 2010, 11:53 AM
  3. Replies: 3
    Last Post: 3 May, 2010, 12:57 PM
  4. Favicon.ico file
    By Micks86 in forum Promoting
    Replies: 3
    Last Post: 8 June, 2009, 08:56 AM

Tags for this Thread

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
  •