Dynamic property tags are very similar to dynamic content tags, except that they are applied to component properties. The purpose of dynamic property tags is to allow more versatile component property configuration. Note, you are not required to use dynamic property tags because what can be done using dynamic property tags can also be done in PHP code. However, using dynamic property tags bring you much more convenience at accomplishing the same tasks. The basic usage of dynamic property tags is as follows,
We now introduce the available types of dynamic property tags that may be used in the above. Like dynamic content tags, we have expression tags, databind tags, parameter tags and asset tags. (Note, there is no statement tag here.)
An expression tag represents a PHP expression that is evaluated when the template is being instantiated. The expression evaluation result is assigned to the corresponding component property. The format of expression tags is as follows,
Note, unlike dynamic content tags, the expressions tags for component properties are evaluated when the components are being constructed, while for the dynamic content tags, the expressions are evaluated when the controls are being rendered.
Databind tags are similar to expression tags, except that the expressions are evaluated only when a dataBind() call is invoked on the controls represented by the component tags. In the expression, $this refers to the control itself. Databind tags do not apply to all components. They can only be used for controls.
The format of databind tags is as follows,
Parameter tags are used to assign application parameter values to the corresponding component properties. The format of parameter tags is as follows,
Asset tags are used to publish private files and assign the corresponding the URLs to the component properties. For example, if you have an image file that is not Web-accessible and you want to make it visible to end-users, you can use asset tags to publish this file and show the URL to end-users so that they can fetch the published image.
The format of asset tags is as follows,
BE VERY CAUTIOUS when you are using asset tags as it may expose to end-users files that you probably do not want them to see.