Announcement

Collapse
No announcement yet.

include file

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

  • include file

    i tried to include a file inside a file named 1.php. but dono why the file is not called out. and my page's alignment runs. this is the page:

    http://www.certifyexpress.com/test/1.php

    this is how i include the file:
    include ("http://www.certifyexpress.com/rate/rate.php");

    if i put ("../rate/rate.php");
    it will have error.

    pls help.

  • #2
    include("/rate/rate.php");

    Try like that....

    Comment


    • #3
      this error appear:

      Warning: Failed opening '/rate/rate.php' for inclusion (include_path='.:/usr/local/plesk/apache/lib/php') in /usr/local/plesk/apache/vhosts/certifyexpress.com/httpdocs/test/2.php on line 115

      Comment


      • #4
        include("../rate/rate.php");

        you forgot the two dots

        Comment


        • #5
          Hi I tried the same thing and got the same error
          I finalized it by including the absolute path address (just like you did, in html you can do ../ but I don't know a way in php)

          PHP Code:
          include ("http://www.certifyexpress.com/rate/rate.php"); 
          If you would like the code to be modular you can add a variable
          PHP Code:
          $home "http://www.certifyexpress.com";
          include (
          "$home/rate/rate.php"); 
          I am sorry I do not know any other way, but I hope someone can help you more.

          Comment


          • #6
            Just a suggestion

            if in the same dir.
            include("rate.php");
            or maybe this
            ("rate/rate.php");
            or you could start from ther begginning
            include("home/usr/httdocs/rate/rate.php")

            a couple of thoughts.

            Comment


            • #7
              This is what you want:
              include ("$DOCUMENT_ROOT/rate/rate.php");

              $DOCUMENT_ROOT will print the path to your publich_html directory.

              Read more here.

              You can also alter the include_path. This is really good if you store all your include files in one dir.
              PHP Code:
              ini_set("include_path"ini_get("include_path") . ":" $DOCUMENT_ROOT "/my_includes"); 
              Throw all your include files into $DOCUMENT_ROOT/my_includes.
              Now, you can access them from anywhere in the site by using just the filename, no path.

              Read more here and here.

              This can also be achieve via .htaccess. I don't know how, I've never dealth with PHP flags in .htaccess.

              Comment

              Loading...
              Working...
              X