Fatal error: Cannot redeclare myFunction()
-
- Regular
- Posts: 3652
- Joined: Mon Feb 13, 2006 2:40 am
- Location: Chicago, IL, USA
- Contact:
Fatal error: Cannot redeclare myFunction()
I have two different themes that have an identically names function in config.inc.php. Whenever I switch between these themes, I get this error. Is there a way to avoid this?
=Don=
-
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Fatal error: Cannot redeclare myFunction()
Hey,
hm where exactly does the error happen, what's the exact output?
You could in your config.inc.php use a
to wrap a check around your function definition.
However I don't really understand in which case BOTH themes can be loaded at once, it should only always load one theme, not two...
hm where exactly does the error happen, what's the exact output?
You could in your config.inc.php use a
Code: Select all
<?php
if (!function_exists('blabla')) {
function blabla(...)
}
However I don't really understand in which case BOTH themes can be loaded at once, it should only always load one theme, not two...
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
- Regular
- Posts: 3652
- Joined: Mon Feb 13, 2006 2:40 am
- Location: Chicago, IL, USA
- Contact:
Re: Fatal error: Cannot redeclare myFunction()
Here is the scenario: Lets say I am using my theme Kinetic, and has a function named myFunction. Then I switch to a different theme named "Clean", which also has this function named myFunction. As soon as I select this second theme, I get the error:
Fatal error: Cannot redeclare myFunction() (previously declared in /var/www/vhosts/com/templates/clean/config.inc.php:11) in /var/www/vhosts/com/templates/kinetic/config.inc.php on line 33.
I can use my browser "back" button to get back to the admin page, and everything is fine from that point forward. There is no further notice or error - it only happens when I initially select a theme that has a function with the same name as the theme I just switched from. It is as if for that brief moment, both theme's configs are loaded.
Fatal error: Cannot redeclare myFunction() (previously declared in /var/www/vhosts/com/templates/clean/config.inc.php:11) in /var/www/vhosts/com/templates/kinetic/config.inc.php on line 33.
I can use my browser "back" button to get back to the admin page, and everything is fine from that point forward. There is no further notice or error - it only happens when I initially select a theme that has a function with the same name as the theme I just switched from. It is as if for that brief moment, both theme's configs are loaded.
=Don=