|
Posted by Jochem Maas on 05/26/05 14:29
Charles Kline wrote:
>
> On May 25, 2005, at 7:53 PM, Richard Lynch wrote:
>
>> On Wed, May 25, 2005 11:30 am, Charles Kline said:
>>
>>> i have 2 class files. say for example.
>>>
>>> class 1
>>>
>>> class 2 extends class 1
>>>
>>> class 2 uses include_once("firstclass.php")
include, require, etal are not functions exactly...
therefore the brackets are not required, in case you didn't know.
more importantly I would suggest that the include
statement in your class or where ever should be a require(_once)
statement - because without the first class the second class
cannot be used (i.e. firstclass is required!).
require_once 'firstclass.php';
>>>
>>> then i use include_once ("secondclass.php") in my template. this does
>>> not work. to get it to work, i must put both the files as includes in
>>> my template.
>>> any ideas why?
>>>
>>
>> Could you define "does not work" a little more precisely?
>>
>> Do you get error messages?
>>
>> What do the error messages say?
>>
>> Is there any output at all?
>>
>> Does your computer blow up?
>>
>> What?
>>
>
> Sorry I should have been more specific (or course)...
>
> The template does not load. I get no error messages of any kind. Both
> classes function fine when included into the template separately - but
> when in include the secondclass.php which in turn includes
> firstclass.php the page does not load.
sounds a bit like a problem related to your include_path ....
its possible that the firstclass.php cannot be found in the include path from
within secondclass.php OR maybe a different file is being found
(a file also called firstclass.php but containing so kind of error)
what does the following show you? (if you place it in your code):
<?
var_dump( ini_get("include_path") );
?>
btw I see such a problem regularly, that is - a require_once statement
fails because the file was not found and the script terminates
with no errors (ANYWHERE!)
ps - what the heck is a 'template' in your world?
pps - do you have error reporting turned up fully? are you logging and/or
outputing errors at all?
>
> Running on Mac OS X Server version 10.3
>
> - Charles
>
Navigation:
[Reply to this message]
|