exp:exptemplateconvertstpltotwig
Convert the Smarty templates (.stpl) of a design to Twig templates (.twig); --dry-run, --file, --force, --override-ini, --twig-suffix.
Script bin/php/exptemplateconvertstpltotwig.php, code in kernel/private/classes/commands/exptemplateconvertstpltotwig.php. Run it from the installation root, as the user the web server runs as:
./console exp:exptemplateconvertstpltotwig --help
./console exp:template:convert:stpl-to-twig --help
php bin/php/exptemplateconvertstpltotwig.php --helpHelp text
Convert Smarty templates (.stpl) to Twig templates (.twig)
Every *.stpl below --from becomes the *.twig at the same place below --to (templates/ and
override/templates/ alike), so that it prints what the .stpl printed.
The .stpl is converted to Exponential templates and then to Twig, in memory, in one run.
--override-ini writes the override rules that make the -s siteaccess use the .twig.
The same as exp:template:convert --from-engine=stpl --to-engine=twig.
./console exp:template:convert:stpl-to-twig --from=extension/<ext>/design/<design> --to=var/tmp/<design>
./console exp:template:convert:stpl-to-twig --from=extension/<ext>/design/<design> --dry-run
./console exp:template:convert:stpl-to-twig --file=design/<design>/templates/<name>.stpl
./console exp:template:convert:stpl-to-twig -s <siteaccess> --from=<design> --to=<design> --override-ini=<file>
Every written file ends with a marker comment ({# exp:template:convert stpl->twig md5:... from ... #});
a target that has no marker, or was changed after it was written, is skipped (SKIP) unless --force
is given. The result is checked before it is written: a .twig must compile with Twig 3 (when
installed). Prints WRITE or REPLACE for every file written, NOTE for every construct that could not
be converted exactly, ERROR for a template that could not be converted, then PASS or FAIL with the counts.
Exit code: 0 PASS; 1 FAIL (a template could not be read, converted, checked or written); 2 wrong options;
3 the conversion is not available (the engine's library or converter is missing).Options
| Option | Value | Help |
|---|---|---|
--from | required | design directory with the .stpl templates (every .stpl below it is converted) |
--to | required | design directory for the .twig templates (default: the --from directory, next to the sources) |
--file | required | convert this one .stpl only (below --from, or a file of its own: then --to is the target file) |
--override-ini | required | override.ini.append.php to write for the --to design (the -s siteaccess's override rules, MatchFile pointing at the converted .twig) |
--twig-suffix | required | the ending of the written Twig templates: .twig (the default) or .html.twig |
--dry-run | show what would be written; nothing is written | |
--force | also replace a .twig that was changed or written by hand (no marker, or not matching it) |
Read from the option definitions in the code (startup(), getOptions(), options() or ezcConsoleOption). Every script also takes the standard options of the script framework (--help, --siteaccess, --debug, --quiet, --allow-root-user ...).
Related
Generated by ./console exp:help:examples from bin/php/exptemplateconvertstpltotwig.php, kernel/private/classes/commands/exptemplateconvertstpltotwig.php. Do not edit this page: change the source and generate again (how). Free documentation: GFDL 1.3 or later.