Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

PHP classes and file includes

Last post 02-22-2008 1:58 PM by pcaldredbann. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 02-22-2008 1:58 PM

    • pcaldredbann
    • Not Ranked
    • Joined on 11-30-2007
    • United Kingdom
    • New Member
    • Points 25

    PHP classes and file includes

     Hi guys and girls,

     I've ran into a problem with PHP, I'm a C++ programmer by trade but a certain contract requires I use PHP.  However my problem is as follows:

     I'm trying to seperate all the PHP logic from inline (I know class constructs etc will still need to be inline) to make it more manageable - however I'm wanting to store global parameters in a global.inc.php file i.e. database server, username, password etc etc and include this in a MyClass.class.php file so the constructor of the class can access these - but it doesn't seem possible.  I've heard that this isn't a feature in PHP?!?!?!?!

    My directory structure looks something like:

    • ROOT
      • classes
        • MyClass.class.php (the class wanting to use the global.inc.php)
      • config
        • globals.inc.php (contains the global config files for this site)
      • admin.php

     And so in the MyClass.class.php I have

    include("../config/globals.inc.php")
    but it doesn't seem to work...

    Is there some other way around this? Before you answer please bear in mind that the server is many miles away and I have NO access to the php.ini file.

    Will code HTML for food!
    • Post Points: 5
Page 1 of 1 (1 items)