@define - Define Variables
The @define
directive in Ahmed PHP Template Engine allows you to define and store variables for later use within the template.
Syntax
variable
: The name of the variable to define.value
: The value assigned to the variable.
Description
This directive stores a value in a named variable that can be referenced elsewhere in the template.
Useful for defining constants, reusable values, or computed data.
Example
Expected Behavior
The defined variable is available throughout the template.
It can be used in expressions, conditions, and loops.
Notes
Variables defined using
@define
persist within the template but do not carry over to different requests.Useful for improving template readability and avoiding redundant values.
Can be combined with conditional statements and loops for dynamic content.
Last updated