User Tools

Site Tools


developers:templates:reference

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
developers:templates:reference [2014/10/18 12:49]
Jaco van Wyk
developers:templates:reference [2014/10/18 12:50]
Jaco van Wyk [Final Details]
Line 78: Line 78:
 Variables can also be formatted according to a bunch of specific rules. In order to pass the variable to be formatted the code looks like $username(>​upper) which will pass the username to the ‘upper’ function (will look something like “JOSH”). The complete list of current functions available is: upper (upper-case),​ lower (lower-case),​ u2s (underscores to spaces), ucwords (upper-case first letter of each word), ucfirst (upper-case only first letter), and empty (coverts to nothing – which is sometimes useful when combined with the missing variable syntax). Variables can also be formatted according to a bunch of specific rules. In order to pass the variable to be formatted the code looks like $username(>​upper) which will pass the username to the ‘upper’ function (will look something like “JOSH”). The complete list of current functions available is: upper (upper-case),​ lower (lower-case),​ u2s (underscores to spaces), ucwords (upper-case first letter of each word), ucfirst (upper-case only first letter), and empty (coverts to nothing – which is sometimes useful when combined with the missing variable syntax).
  
-The ternary operator is also available as a formatting function. We use the C syntax with <​test>​ ? <if true> : <if false>. If the <if true> section is not specified it defaults to being the same as the <​test>​. This is all most easily demonstrated with sample code.+The [[http://​en.wikipedia.org/​wiki/​Ternary_operation|ternary operator]] is also available as a formatting function. We use the C syntax with <​test>​ ? <if true> : <if false>. If the <if true> section is not specified it defaults to being the same as the <​test>​. This is all most easily demonstrated with sample code.
  
 <​code>​ <​code>​
developers/templates/reference.txt · Last modified: 2019/05/10 07:30 by Jaco van Wyk