forked from TYPO3/Fluid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example_math.php
29 lines (23 loc) · 954 Bytes
/
example_math.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
/*
* EXAMPLE: Mathematical expressions
*
* This example shows you how to use mathematical
* expressions in the Fluid template language to
* perform small inline calculations using variables
* and raw numbers.
*/
require __DIR__ . '/include/view_init.php';
// Assigning View variables: we assign variables that will be used by the
// expressions we build in this example.
$view->assign('numberone', 1);
$view->assign('numbertwo', 2);
$view->assign('numberten', 10);
$view->assign('half', 0.5);
// Assigning the template path and filename to be rendered. Doing this overrides
// resolving normally done by the TemplatePaths and directly renders this file.
$view->getTemplatePaths()->setTemplatePathAndFilename(__DIR__ . '/Resources/Private/Singles/Math.html');
// Rendering the View: plain old rendering of single file, no bells and whistles.
$output = $view->render();
// Output using helper from view_init.php
example_output($output);