timm211 Posted July 12, 2010 Share Posted July 12, 2010 Hello superior PHP gods. I have a vexing problem, and if someone could help I'd be REALLY grateful. Here's the context: I'm building a family history site, www.bennion.org. I've integrated a genealogy software The Next Generation (TNG) with a Wordpress backend. A guy created a WP plugin that integrates TNG with Wordpress, but no longer supports it. It works except that when I log into the Wordpress admin area, then return the page where I've integrated TNG (Family Tree), I get the following error message: Fatal error: Cannot redeclare tng_header() (previously declared in /home/content/b/e/n/bennion/html/wp-content/themes/outreach/genealogy/genlib.php:44) in /home/content/b/e/n/bennion/html/wp-content/themes/outreach/genealogy/genlib.php on line 107 If I refresh the page, it goes away and keeps working, but it scares non-technical usersand obviously isn't a good experience. I'll attach both the genlib.php file, as well as the TNG Wordpress plugin file...if anyone could figure out what's happening I'd be really grateful!! Many thanks, Tim [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/207537-fatal-error-cannot-redeclare/ Share on other sites More sharing options...
timm211 Posted July 12, 2010 Author Share Posted July 12, 2010 Ok, thanks to user Mchl, I figured it out... Mchl directed me to this post: http://www.phpfreaks.com/tutorial/defining-a-php-function-only-once So I went through and added the if(!function_exists('example')){ line (with a } to close) on the tng_header, as well as the 50 or so other functions in that file. Pain in the butt, and probably not the cleanest way to do it, but it works now. Thanks! Tim Quote Link to comment https://forums.phpfreaks.com/topic/207537-fatal-error-cannot-redeclare/#findComment-1085090 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.