About Sitellite       Screenshots       Downloads       Forge      Documentation       Community       Support

You are here: Home / PHP Shorthand Reference

PHP Shorthand Reference

PHP Shorthand is used in SimpleTemplate and XT templates in various tags to simplify the PHP syntax used. In XT this was originally intended to avoid PHP's XML-invalid characters, but it also has the benefit of increasing the readability of template tags by keeping them as alphanumeric as possible.

Keyword Substitutions

Case-insensitive keywords are replaced by their respective operators. These include:

  • AND Becomes "&&"
  • EQ Becomes "=="
  • EQQ Becomes "==="
  • GE Becomes ">="
  • GT Becomes ">"
  • LE Becomes "<="
  • LT Becomes "<"
  • MOD Becomes "%"
  • NE Becomes "!="
  • NEQ Becomes "!=="
  • NOT Becomes "!"
  • OR Becomes "||"

Additional Transformations

  • HTML entities for "<" and ">" are converted to their proper symbols.
  • "." is converted to "->" and to mimick a JavaScript-style object syntax.
  • "_" is converted to "." as an optional additional concatenator.
  • "->" with a space on either side of it is converted back into a ".".
  • Object references are then converted into global references (ie. $GLOBALS['object']->property). This can be changed in specific instances via the PHPShorthand::replaceGlobals() method.
  • Single- and double-quoted strings are handled as special cases and are not transformed.
  • [key] array indexes are expanded to their quoted form (ie. ['key']).

Examples

foo.bar ('foo.bar')

becomes:

$GLOBALS['foo']->bar ('foo.bar')

 

not isset (someArray[keyname])

becomes:

! isset ($GLOBALS['someArray']['keyname'])

 

foo.bar ge bar.foo and not empty (foo.asdf)

becomes:

$GLOBALS['foo']->bar >= $GLOBALS['bar']->foo && ! empty ($GLOBALS['foo']->asdf)

Members

Note: You can use your SitelliteForge.com account here and vice versa.

Username

Password

Forgot your password?

Not a member? Click here to register

Sitellite 5 Beta


Copyright © 2008, SIMIAN systems Inc.
All rights reserved. Privacy policy
Some of the icons on this site were created by the Gnome Project.