The PHx notation
Now that we have discovered situations in which PHx becomes helpful, we will learn the PHx syntax.
Simple usage
PHx can be used to format any template variable by using a simple syntax. The syntax is generally like this: [+templatevariablename:modifier+]
. You can use the [+ +]
syntax, or the [* *]
, syntax just like you do for any other template variable.
Modifiers are special keywords that transform the value of the template variable. We have modifiers to change a string to uppercase, to lowercase, the first character to uppercase, and so on.
For example: If we have a template variable Occupation
with the value business
, then [+occupation:ucfirst+]
will return Business
.
The following is a list of the most commonly used modifiers:
lcase
—returns the current value with all of the alphabetic characters converted to lowercase. For example:If
[+occupation+]
outputsEngineer
, then[+occupation:lcase+]
will outputengineer
ucase
—returns the current value with all of the alphabetic characters...