Forum Moderators: coopster
how do i call a function in includefile2.php from index.php?
ive tried $includefile1.php->function(); but it does not work. can someone help me out?
also is designing a site in such a way a good idea? or should I have includes on 1 level only?
currently in includefile1 i have
function __construct() {
include('includefile2.php');
}
and then in the calling function I set
global $includefile2;
then i try $includefile2->function() and just function() but im getting a Call to undefined function error.
when i do
function __construct() {
include('includefile2.php');
echo is_object($includefile2);
}
this outputs a 1 and shows it is working here ok. but when i do the same thing in the calling function:
function function() {
global $includefile2;
echo is_object($includefile2);
}
it outputs nothing, not even a 0. am i missing something obvious?