Table of Contents

Lint tool

Lint allows you to check syntax of templates (XML well-formedness) without running them. It is useful to run after upgrade of PHPTAL to ensure that everything still works. You can also use it in SVN pre-commit hook to prevent ill-formed templates from being committed to your repository.

Download latest phptal_lint.php


Unix & Mac OS X

You can copy phptal_lint.php to directory in your path (e.g. /usr/local/bin). Run echo $PATH to see which directories you have in path.

Or you can run it by always specifying full path to the phptal_lint.php file (most terminals support drag'n'drop, so just drop phptal_lint.php file into terminal window instead of typing entire path).

If you're getting errors that phptal_lint.php is not executable:

chmod a+rx /full/path/to/phptal_lint.php

If you're getting errors about missing interpreter, then use:

php /full/path/to/phptal_lint.php

to run the tool.


 C:\path\to\php.exe C:\path\to\phptal_lint.php

Running of this tool from %PATH% requires writing DOS batch file that passes arguments appropriately.


 phptal_lint.php [-e extensions] [-i php_file_or_directory] file_or_directory_to_check ...


phptal_lint.php .

Scan current directory for all templates (templates are recognized by popular file extensions). TALES modifiers (as in ${mycustommodifier:foo/bar}) will be ignored.

phptal_lint.php -e xhtml,zpt,tal,phtml -i myproject/includes/phptalmodifiers.php myproject/templates/

Checks only *.xhtml, *.zpt, *.tal and *.phtml files in myproject/templates/. Will load myproject/includes/phptalmodifiers.php file first assuming it defines all TALES modifiers used by the templates.