I understand how templates work. Where I can include a block of html, rather then having to hardcode it into each page.
Example: include 'templates/header.php';
Now lets say I have some functions that I want to include into each page, how do I do this?
When I try to do so, I get this error.
Fatal error: Cannot redeclare html2txt() (previously declared in /.../addperson.php:4) in /.../config.php on line 21
How do I work around this; rather then just answer, any tutorials or anything like that would be great. Not too sure what topic this would fall under so I'm having trouble researching it.
THANKS!
Functions File?
Moderator: General Moderators
Function are not defined per file but per php instance. There's obviously no need to include addperson.php again - the functzion is still known to php.
If you do not want to keep track yourself try require_once
If you do not want to keep track yourself try require_once