[thelist] "Notice: ..." errors

Mike Migurski mike-evolt at teczno.com
Mon Jul 12 13:33:13 CDT 2004


> If I add the following line (default in php.ini), the errors go away:
>
> error_reporting(E_ALL ^ E_NOTICE);
>
> My question: do does errors mean that the class still has problems and I
> should look for another template class, or is it ok to use it (and
> "supress" the errors) on a production system?

PHP has different levels of error severity built in. "Notice" is pretty
low on the list -- your code will probably run just fine with notices
turned off (in fact, you should have all error reporting turned off on
your production environment), but they do help point out potential coding
mistakes during development. The one you're seeing, for example, is
telling you that you're trying to reference an undefined array element,
which could be a sign of a bug or problem.

PHP defines 4 general levels of error:

	Parse: Compile-time parse errors. Parse errors should only be
	generated by the parser.

	Error: Fatal run-time errors. These indicate errors that can not
	be recovered from, such as a memory allocation problem.
	Execution of the script is halted.

	Warning: Run-time warnings (non-fatal errors). Execution of the
	script is not halted.

	Notice: Run-time notices. Indicate that the script encountered
	something that could indicate an error, but could also happen in
	the normal course of running a script.

You can also define your own, if you're writing your own error-handling.
See http://www.php.net/manual/en/ref.errorfunc.php for more info.

> Tips for templating classes also welcome. I want something
> FastTemplate-like, not Smarty-like. I am not using FastTemplate itself
> because it was php3 and hasn't been optimized for php4 as far as I know.
> It also doesn't do nested templates (which the above class does use). I
> don't need caching btw.

PHP is itself a templating engine. If you just need to include files that
echo values, you can't go wrong with regular old includes with echo
statements and basic control structures. The onus would be on you to
practice self-discipline in separating display code from business logic,
which I've found to be a benefit in itself.

---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca            http://mike.teczno.com/contact.html



More information about the thelist mailing list