Re: Gawd I hate those useless error messages...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 17:00 29-10-2004, Robby Russell wrote:
On Fri, 2004-10-29 at 16:28 +0200, -{ Rene Brehmer }- wrote:
> Hi gang
>
> I do realise that this error means I've forgotten a curly brace or
> semi-colon somewhere, but seriously ...
>
> Parse error: parse error, unexpected $end in E:\web\Metalbunny\addguest.php
> on line 274
>
> where line 274 would be the last line, obviously (since it's always the
> last line when it does this)...

[snip]

Yeah, don't make errors in your code. ;-)

Oh, that I do try ... perfectionist at heart :p


Also, try to seperate your html and php code as much as possible. Use a
template system of some form. (ie. smarty)

I am, trust me :) ... There are just some cases where it's not really practical to split the scripts anymore than I do. Like in this case where it's the submission form for the guestbook ... First I've got about 200 lines of code (ok, 30 of them is an array with country names that I only use on this page and nowhere else) that handle the part of the form evaluation and SQL generation that is unique to this page, and outputting error and thank you notices as needed. Then there's the form itself with the embedded PHP code to refill the form in case of errors. It's the last part where I jump in and out of PHP, since it really IS the simplest way to get the PHP to put data into an otherwise static chunk of HTML.


I use my own made template system. It's made in a shell form, where the scripts simply put the top and the bottom in so the generated body goes in between. It's not the most elegant solution, but my latest revision is a bit more intelligent made so the templates keeps track of basically everything but the body generation. But it works fast, and speed is my main concern, since some of the pages can get a bit lengthy depending on queries. All longer text pieces are in seperate text/html-files and are simply included if/when needed.

I haven't really looked at special-made template systems because my own works well enough for my needs ... and as long as it can generate even the heaviest page in 10 secs I'm happy.

Use a PHP editor with syntax highlighting..click on one curly brace and
then find where the other highlighted brace is and make sure that it
where it should end.

Anyone you can recommend ? ... I've been using HomeSite for 6 years, and it's admittedly a little annoying when it comes to PHP, cuz although the colour-/bold-ing highlighting works for most commands, it's made to handle JavaScript, JSP, and ASP, so its understanding of PHP isn't the best.


Learn how to debug your code. See how far it's getting for each
thing..add test messages and die() in different scopes of code.

That I know ... but I've only been at PHP for 2 years, so still alot to learn ... but it's gotten better, and the errors are fewer. That said, the $end errors I run into nowadays are mostly caused when I rewrite my first scripts and delete large chunks of it that are no longer needed cuz I've got objects/functions that handle that now. Sometimes it's just the "ok, what does it look like now" approach that makes errors occur, when trying to run unfinished code.



Rene -- Rene Brehmer aka Metalbunny

If your life was a dream, would you wake up from a nightmare, dripping of sweat, hoping it was over? Or would you wake up happy and pleased, ready to take on the day with a smile?

http://metalbunny.net/
References, tools, and other useful stuff...
Check out the new Metalbunny forums at http://forums.metalbunny.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux