Troubleshooting
Nette is not working, white page is displayed
- Run Requirements Checker and check, if webhosting supports Nette Framework.
- Check if directories
tempandlogare writable - Force Debugger to work in development mode
(
Debugger::enable(Debugger::DEVELOPMENT)).
Error 404 – page not found
Check the path and the name of template file – lower/upper case, extension
.latte.
Use of characters { } in JavaScript
Characters { a } are used for writing Latte macros.
By default everything (except space and quotation mark) following the
{ character is considered a macro. If you need to print character
{ (often in JavaScript), you can put a space (or other empty
character) right after {. By this you avoid interpreting it as
a macro.
If it's necessary to print these characters in a situation where they would
be interpreted as a macro you can use specials macros to print out these
characters – {l} for { and {r}
for }
{is macro}
{ is NOT macro }
Routing is not working
- It matters if the module is defined in the route by the presenter (i.e. is set the same as presenter) or separately (then the URL must contain <module> to change it)
- Check lower/upper case (
'Module' => 'Front'will not work,'module' => 'Front'will). - Check if mod_rewrite is allowed.
Some browsers remember redirection so after a change of router it is neccessary to flush their cache.
Randomly appearing open_basedir problem
It is a PHP bug and is solved by upgrading to newer PHP.
Slow Debugger
Set lower depth of nesting arrays and objects Debugger::$maxDepth and smaller length for displaying strings in Debugger::$maxLen.
MIME-type file validation
Sometimes MIME-type validation does not work, respectively throws an error in file which should pass the validation. Problem is not in the Nette Framework. Solve the problem by installing Fileinfo library (in PHP 5.3 it is natively supported and allowed).
I miss a library for AMF, Amazon S3, OpenID, …
Nette Framework does not want to be a library, i.e. a large set of classes providing with numerous services but a framework – a compact set with specific style of work (so called Nette-way). Framework is therefore relatively small but with a series of addons while their most compact set is the Zend Framework.
Template from a string
If you need to use a template (especially Latte) stored in a string (e.g. returned from a database) then set it with the method Nette\Templating\Template::setSource().
How to allow mod_rewrite?
Apache extension called mod_rewrite must be allowed to create so called
cool-URL. This commands will allow mod_rewrite in a
.htaccess file.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !\.(pdf|js|ico|gif|jpg|png|css|rar|zip|tar\.gz)$ index.php [L]
