-
Book Overview & Buying
-
Table Of Contents
MODx Web Development - Second Edition
By :
Now that we have discovered situations in which PHx becomes helpful, we will learn the PHx syntax.
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:[+occupation+] outputs Engineer, then [+occupation:lcase+] will output engineerucase—returns the current value with all of the...
Change the font size
Change margin width
Change background colour