473,623 Members | 2,362 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2155
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**@doesntexi st.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.or g> 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
1384
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
5365
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 would need to use?
2
2003
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. I want to ensure the user does not submit the form with the default value selected.
2
13260
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. I went ahead and wrote my own bit of code so I'm sharing it here for everyone. Even though it doesn't really disable the button by greying it out, it prevents the multiple submissions which it what I was attempting to prevent all along. ...
3
4897
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. -------------------------------------------------------------------------------- Runtime Error Description: An application error occurred on the server. The current
4
4882
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. IF the file includes the connection string than anyone could see my database name and password..... How can i prevent this??
5
7322
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 rejectEnter( oEvent ) { if ( 13 == oEvent.keyCode )
3
5283
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 unicode=e.charCode? e.charCode : e.keyCode if (unicode!=8){ //if the key isn't the backspace key (which we should allow) if (unicode<48||unicode>57) //if not a number return false //disable key press
0
8668
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8325
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6105
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5561
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4071
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4160
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2599
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1776
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1471
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.