PHP Classes

File: docs/Features/Formulas.md

Recommend this page to a friend!
  Packages of Rafa Rodriguez   Div PHP Template Engine   docs/Features/Formulas.md   Download  
File: docs/Features/Formulas.md
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: Div PHP Template Engine
Template processing engine that replaces tags
Author: By
Last change:
Date: 3 months ago
Size: 631 bytes
 

Contents

Class file image Download

To make calculations and other advantages. The formula is a valid PHP expression. See the [[Appendix A - Allowed PHP functions]]

Syntax in templates     

(# formula #)
    
OR
    
(# formula : number format #)

    The number format are explained in Data formats.

Example

index.tpl     

{= number: 200.000 =}
{=  price:  20.000 =}
{=    tax:   0.345 =}
    
5 + {$number} = (# 5 + {$number} #)
    
Price with tax: ${$price} + ${#tax:2.#} = $(# {$price} + {$tax} :2. #)

     Output

5 + 200 = 205
    
Price with tax: $20 + $0.35 = $20.35