DynamicTemplateAllowPHP
This is documentation about a configuration directive, which can be placed within Movable Type’s core configuration file, mt-config.cgi, to customize the behavior of the system.
Specifies whether to allow the execution of PHP code written directly in templates in Dynamic Publishing. Specify 1 to allow execution, or 0 to restrict (deny) execution. PHP code written in the following syntax is targeted:
{{php}}...{{/php}}<?php ... ?>
The default value varies depending on the version of Movable Type.
PHP code contained in template tag output
Even if PHP code is contained in content output by template tags (such as entry body text), it will not be executed regardless of this setting. However, as an exception, PHP code contained in content loaded via MTInclude, MTIncludeBlock, MTWidgetSet, or MTWidgetManager will be executed if any of the following conditions are met:
- The site’s include method is set to PHP, and
ssi="1"is specified inMTIncludeorMTIncludeBlock. - The Server Side Includes setting is enabled for the target template to be loaded (for
MTWidgetSetandMTWidgetManager, the settings of each loaded widget are applicable).
In Movable Type 8.8.7, this behavior was changed so that PHP code will be executed when the above conditions are met, even if this setting is 0. The behavior in Movable Type 9 is the same.
Usage
DynamicTemplateAllowPHP 0
Default Value
- Movable Type 8 and earlier:
1 - Movable Type 9 and later:
0