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
Previous revision
Last revision Both sides next revision
developers:templates:reference [2014/10/18 12:49]
Jaco van Wyk
developers:templates:reference [2014/10/18 12:51]
Jaco van Wyk [Template Reference]
Line 1: Line 1:
 ====== Template Reference ====== ====== Template Reference ======
  
-The syntax draws inspiration from Markdown, a little from the PHP programming language as well as a few ideas from the template system in my pre-Ubuntu favourite music player foobar2000. I’ve tried to keep it as easy to read as possible, but in quite a few places I have chosen to put power and flexibility first.+The syntax draws inspiration from [[http://​daringfireball.net/​projects/​markdown/​|Markdown]], a little from the [[http://​www.php.net/​|PHP]] programming language as well as a few ideas from the template system in my pre-Ubuntu favourite music player ​[[http://​www.foobar2000.org/​|foobar2000]]. I’ve tried to keep it as easy to read as possible, but in quite a few places I have chosen to put power and flexibility first.
  
 ===== The Basics ===== ===== The Basics =====
Line 74: Line 74:
 ===== Final Details ===== ===== Final Details =====
  
-There are a few more features that have not been covered yet. The first important one is including links in your template. This is achieved by wrapping an address in double square brackets such as “[[www.google.com]]”. We also allow link captions that are different from the address, by including a vertical bar: “[[www.google.com|Google Website]]”+There are a few more features that have not been covered yet. The first important one is including links in your template. This is achieved by wrapping an address in double square brackets such as “[[http://www.google.com]]”. We also allow link captions that are different from the address, by including a vertical bar: “[[http://www.google.com|Google Website]]”
  
 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