Query::Include_Once() + Class File
Posted: Tue May 18, 2004 2:37 pm
Alright...
Prep For Question. ( This is a hypothetical question... )
I have a file: public_html / index.php
I have a class: public_html/libraries/classes/system/class_system.php
I have a class: public_html/libraries/classes/db/class_databaseaccess.php
In class_system.php I have a method...
->_IncludeDB
In index.php I am thinking of doing something akin to:
Ok...
I OBVIOUSLY need to give a PATH the Include to work... WHERE DO I SET THIS...?
Do I set the path IN the class? In the index.php?
I was thinking that since the class_system.php is the actual FILE that calls the INCLUDE statement, I would need to set the path to the class_databaseaccess.php file FROM the class_system.php file... But then I thought that since the CLASS was actually instantiated IN index.php, maybe the path needs to be set in Index.php...
But I am unsure... And so I come to the smart-guys here on the forums... Any help would be appreciated... Thanks in advance...
Prep For Question. ( This is a hypothetical question... )
I have a file: public_html / index.php
I have a class: public_html/libraries/classes/system/class_system.php
I have a class: public_html/libraries/classes/db/class_databaseaccess.php
In class_system.php I have a method...
->_IncludeDB
Code: Select all
<?php
function _IncludeDB()
{
include_once( 'class_databaseaccess.php' );
}
?>Code: Select all
<?php
include( '/libraries/classes/system/class_system.php' );
$basic = new system();
$basic->_IncludeDB();
$basic->...something or other database oriented...
?>I OBVIOUSLY need to give a PATH the Include to work... WHERE DO I SET THIS...?
Do I set the path IN the class? In the index.php?
I was thinking that since the class_system.php is the actual FILE that calls the INCLUDE statement, I would need to set the path to the class_databaseaccess.php file FROM the class_system.php file... But then I thought that since the CLASS was actually instantiated IN index.php, maybe the path needs to be set in Index.php...
Code: Select all
<?php
include_path( '/libraries/classes/system/' );
include( 'class_system.php' );
$basic = new system();
include_path( '/libraries/classes/db/' );
$basic->_IncludeDB();
$basic->...something or other database oriented...
?>