473,246 Members | 1,349 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,246 software developers and data experts.

How to prevent includes from attempting redefinitions

I import library routines using include(...);

However, importing library routines that themselves use other library routines
easily leads to repeated declarations - which give errors of the form:

``Fatal error: Cannot redeclare method_name() (previously declared in
/usr/local/home/httpd/vhtdocs/timtyler/php/table_highlight_border.inc.php:2)
in /usr/local/home/httpd/vhtdocs/timtyler/php/table_highlight_border.inc.php
on line 11''

Should I try setting flags - and doing things conditionally?

What is the best approach for working around this issue?
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #1
3 2133
Tim Tyler wrote:
I import library routines using include(...);

However, importing library routines that themselves use other library routines
easily leads to repeated declarations - which give errors of the form:

``Fatal error: Cannot redeclare method_name() (previously declared in
/usr/local/home/httpd/vhtdocs/timtyler/php/table_highlight_border.inc.php:2)
in /usr/local/home/httpd/vhtdocs/timtyler/php/table_highlight_border.inc.php
on line 11''

Should I try setting flags - and doing things conditionally?

What is the best approach for working around this issue?

Try include_once() that way PHP will keep track of if it has included
the file already and won't try again.

--
John Downey
http://delusive.dyn.ee
http://sage.dev.box.sk
http://blacksun.box.sk

Jul 17 '05 #2
John Downey <bl**@doesntexist.com> wrote or quoted:
Tim Tyler wrote:

What is the best approach for working around this issue?


Try include_once() that way PHP will keep track of if it has included
the file already and won't try again.


Thanks.
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #3

"Tim Tyler" <ti*@tt1lock.org> wrote in message news:Hn********@bath.ac.uk...
I import library routines using include(...);

However, importing library routines that themselves use other library routines easily leads to repeated declarations - which give errors of the form:

``Fatal error: Cannot redeclare method_name() (previously declared in
/usr/local/home/httpd/vhtdocs/timtyler/php/table_highlight_border.inc.php:2) in /usr/local/home/httpd/vhtdocs/timtyler/php/table_highlight_border.inc.php on line 11''

Should I try setting flags - and doing things conditionally?

What is the best approach for working around this issue?
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.


You can use include_once() or else perform your includes from within the
parent calling script (as opposed to having one include inside another
included function/script), place what you want to include at the very
begining of your script
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Just1Coder | last post by:
How can I prevent posting of a form from any other site but the site the form lives on?
14
by: Ludwig77 | last post by:
I read that there are some tags that can be entered in a web page's meta tags in order to prevent web bot searching and indexing of the web page for search engines. What is the tagging that I...
2
by: iam247 | last post by:
Hi I have an ASP form which only includes an option list. The list is dynamically created but includes a default value, which is an instruction "Select a group". The code is shown at bottom....
2
by: techfuzz | last post by:
I scoured this group and others looking for the best way to disable a button after the first click to prevent multiple submissions, but never did find anything that worked like they said it would. ...
3
by: Damian | last post by:
Hi everyone I'm having an issue with one of our applications. I'm getting the following error when attempting to log in to the site: Server Error in 'xxxxxxxxxxxxxxxx' Application....
4
by: Mark | last post by:
Can anyone tell me how i can prevent that users can see my connection string to mysql database? Using my browser i could easely use the function: view source.....showing the html/php code. ...
5
by: Robert S | last post by:
I am using the following to prevent the Enter key from submitting my form (this would have undesirable results): (index.html) <body onkeydown="rejectEnter( event )"> (functions.js) function...
3
by: GarryJones | last post by:
I found this handy little script on the net that means the user can only press backspace or numbers in form input. <script type="text/javascript"> function numbersonly(e){ var...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.