Forum Moderators: coopster
So i am trying to make a functions.php file that i will include in my script to just make the code cleaner etc. (I don't know if anybody else ever does this, but its what i want) I have A LOT of errors in my functions and i've tried for the past 3 hours to get rid of them, i get errors when running functions.php like...
Parse error: syntax error, unexpected '{' in /home/#*$!x/public_html/#*$!/functions.php on line 19
unexpected T_Variable...
unexpeected T_ELSE...
all kinds of things, but i moved stuff around and NOTHING seems to work!
My Questions:
1. What am i doing wrong.
2. How do i fix it.
3. Is it cool/helpful/useful to make a functions.php file?
(ALSO IF YOU CAN I HAVE SOME QUESTIONS ABOUT arrays, please see my other topic :) thanks)
[edited by: coopster at 11:36 pm (utc) on Jan. 21, 2008]
[edit reason] removed code dump [/edit]
Yes, it is common to use a "functions.php" script as you mention. Quite common. First, I see you have your error_reporting [php.net] turned on while you are developing so you can see your messages. This is a good thing! But do not forget to log your errors on your production machine as opposed to dumping errors to the browser. Users don't understand the cryptic error messages and they can be a security risk. So, keep that in mind.
Instead of moving too many things around, take each message one at a time. Locate the line number in your script that the message applies to and figure out what is wrong with that line. Fix the code and try your script again. Move on to the next error until they are all fixed.