473,386 Members | 1,873 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,386 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 2140
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.