Timeline for PHP Fatal error: Cannot redeclare distance() when making a new block
Current License: CC BY-SA 4.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 26 at 22:02 | vote | accept | spreaderman | ||
Aug 26 at 17:42 | answer | added | Pat J | timeline score: 2 | |
Aug 26 at 3:18 | comment | added | spreaderman | Thank you very much. I created a function.php and called it from my template with require_once('functions.php'); and it now works. If @Pat J sets the answer, I can check it as correct. Much appreciated! Also thank you to Wongjn ! | |
Aug 25 at 22:01 | comment | added | Wongjn | To elaborate on @PatJ's point, a template file may be included multiple times. Thus, if there is a function declaration in one, that would be included multiple times too. Thus, this causes the redeclaration error. | |
Aug 25 at 14:28 | comment | added | Pat J |
It looks like you're defining distance() in a template file. Try moving that code to a separate file that is then loaded by the template file (using, eg, require or something similar).
|
|
Aug 25 at 12:42 | history | asked | spreaderman | CC BY-SA 4.0 |