Page 1 of 1

Now optional files : action/material/view/tpl

Posted: 27 November 2024, 11:20
by thoun
Some of you already noticed: when you generate a new project, these files are not generated anymore.
The replacements are :
X.action.php => use autowired actions directly in the game file
material.inc.php => if you want to split you material data outside of the game.php file, you can generate material files in modules/php
X_X.tpl & X.view.php => generate the template on the JS file using string templates

All these changes have been applied to the Reversi tutorial, I recommend to (re-)read it if you want to see concrete examples of these changes.

Note: you can still create the optional file with the correct name, if you want to use the old way.

Re: Now optional files : action/material/view/tpl

Posted: 13 January 2025, 20:31
by The Red Kite
I thought I would just create a test project to try out some TPL ideas and... I just noticed this. Was a shock to be truthful.

I get the idea of adding HTML fragments via javascript but it is not a panacea. Writing HTML in an HTML file feels more natural (imho).

I don't want to halt progress. I am sure there is a good set of reasons but this is a significant change.

I was able to create a TPL file as suggested. Remember that the file has to be called <project>_<project>.tpl and it has to be placed in the top-level folder. Also you need to comment out the JS fragment that writes the 'Player zone content goes here' so that your TPL based HTML doesn't disappear.

Re: Now optional files : action/material/view/tpl

Posted: 22 November 2025, 21:59
by antromusx
Does it make sense to refactor an old project for a new standards (getting rid of deprecated .tpl, action.php, view.php, states.php, etc.)?

Looks like quite a lot of work and I don't want to break a working implementation, if compatibility with the old format remains.
What do fellow developers do?