1

I've used the ?tmpl=scriptnamewithoutextension (where the scriptnamewithoutextension is a php file stored in the template used) for a very long time.

I started using Joomla 3.5 and it no longer works!

Anyone knows why, and how to make it work again? (or an alternative).

  • It works for me on Joomla 3.5, could be something else? Have you tried on a clean joomla installation? Are htaccess and sef enabled? – Kitase88 Apr 4 '16 at 11:40
  • Indeed it works on a clean installation! I will have to catch what is preventing it from working, at least it's nice to know that it is still working in joomla 3.5! – jackJoe Apr 4 '16 at 17:16
1

Possibly related to the template positions preview option?

extensions > templates > options

enter image description here

  • It does work, for some reason at the time of the question it didn't, I will update with an answer. – jackJoe Sep 29 '16 at 8:44
1

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:

  1. 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

  2. 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.

  3. 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

  4. 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.