Re: Making includes easy.... Am I a 'tard?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I haven't bothered to benchmark this, but here is my own solution to this problem. If you already have a common file that you are including in every script then the cost should be very low. Feel free to use it if you prefer.

Apache
  htdocs
    site1
      includes
        common.php
        test_include.php
        testfolder
          test2.php
    site2
      includes
        (those four files)
    etc...

<!-- common.php -->
<?php

$basedir = dirname(__FILE__) . '/';

?>

<!-- test_include.php -->
<?

include_once common.php;
/** Now you can include files relative to the base directory */
include_once $basedir . 'testfolder/test2.php';

?>


-- Teach a person to fish...

Ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html
PHP Manual: http://php.net/manual/
php-general archives: http://marc.theaimsgroup.com/?l=php-general&w=2

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux