O'Reilly logo

MODx Web Development by Antano Solar John

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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:

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required