From: David Mehler on
Hello,
I've got a page that uses include_once to include a set of functions
for use in that page. I later have another include_once pulling in
another page, which generates a table. It relies on a function from
the first file, yet an error is being generated undefined function, I
thought that since the function was included in the main page, and
that since the table file was also being included in the main page
that the functions would also be available to the table file. Is this
not so?
Thanks.
Dave.
From: Ashley Sheridan on
On Fri, 2010-06-11 at 06:34 -0400, David Mehler wrote:

> Hello,
> I've got a page that uses include_once to include a set of functions
> for use in that page. I later have another include_once pulling in
> another page, which generates a table. It relies on a function from
> the first file, yet an error is being generated undefined function, I
> thought that since the function was included in the main page, and
> that since the table file was also being included in the main page
> that the functions would also be available to the table file. Is this
> not so?
> Thanks.
> Dave.
>


It should be available. Can you show the code you're using? Is the first
include being called within some form of if statement? That might
explain why it's not available when you expect it.

Thanks,
Ash
http://www.ashleysheridan.co.uk


From: Richard Quadling on
On 11 June 2010 11:41, Ashley Sheridan <ash(a)ashleysheridan.co.uk> wrote:
> On Fri, 2010-06-11 at 06:34 -0400, David Mehler wrote:
>
>> Hello,
>> I've got a page that uses include_once to include a set of functions
>> for use in that page. I later have another include_once pulling in
>> another page, which generates a table. It relies on a function from
>> the first file, yet an error is being generated undefined function, I
>> thought that since the function was included in the main page, and
>> that since the table file was also being included in the main page
>> that the functions would also be available to the table file. Is this
>> not so?
>> Thanks.
>> Dave.
>>
>
>
> It should be available. Can you show the code you're using? Is the first
> include being called within some form of if statement? That might
> explain why it's not available when you expect it.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>

You would probably be better served with changing the include_once to
require_once.

If there is a dependency, then using require will enforce it. E_FATAL
is produced if a required file is not available.



--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
From: Richard Quadling on
On 11 June 2010 12:45, Richard Quadling <rquadling(a)gmail.com> wrote:
> On 11 June 2010 11:41, Ashley Sheridan <ash(a)ashleysheridan.co.uk> wrote:
>> On Fri, 2010-06-11 at 06:34 -0400, David Mehler wrote:
>>
>>> Hello,
>>> I've got a page that uses include_once to include a set of functions
>>> for use in that page. I later have another include_once pulling in
>>> another page, which generates a table. It relies on a function from
>>> the first file, yet an error is being generated undefined function, I
>>> thought that since the function was included in the main page, and
>>> that since the table file was also being included in the main page
>>> that the functions would also be available to the table file. Is this
>>> not so?
>>> Thanks.
>>> Dave.
>>>
>>
>>
>> It should be available. Can you show the code you're using? Is the first
>> include being called within some form of if statement? That might
>> explain why it's not available when you expect it.
>>
>> Thanks,
>> Ash
>> http://www.ashleysheridan.co.uk
>>
>>
>>
>
> You would probably be better served with changing the include_once to
> require_once.
>
> If there is a dependency, then using require will enforce it. E_FATAL
> is produced if a required file is not available.
>
>
>
> --
> -----
> Richard Quadling
> "Standing on the shoulders of some very clever giants!"
> EE : http://www.experts-exchange.com/M_248814.html
> EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> ZOPA : http://uk.zopa.com/member/RQuadling
>

And that is, of course, a fatal E_ERROR, not an E_FATAL error.

--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling