At the time of the question it didn't work (for some reason that I didn't find out).
It does work as expected in every version of Joomla that I've tested since (including 3.6.2).
For the ones that don't know what this is, here's some background:
If you want to run a particular PHP file in the site's context (without some complex hacking or via an extension), for example if you would like to do a database call in development, you just need to place that PHP file inside the current template's folder, and then (in the browser) call it without the extension.
For example:
I would like to update all my users with some complex database query
(that would be easier to do in a Joomla environment vs doing it
directly in mySQL), and for that I would code a PHP file to do the
database queries, let's call it databasequery.php
Now move/copy that file into your current template folder, so that
it sits in the root of the template together with the template's index.php, etc.
To call that file, go to your browser and type ?tmpl=databasequery
after the site address (notice the file name without the file
extension!). So, for example:
www.thisismysitenamehere.tld/?tmpl=databasequery
- That's it!
NOTE: depending on the use of this technique, and if you use it for custom temporary coding, don't forget to remove it when you place your site in production.
You can also use this technique to do AJAX calls, and it plays well with the defined( '_JEXEC' )
and the Joomla libraries, because it is in the Joomla context.