It is comprised entirely of free form HTML
If you are feeling extra bold you can use the templating engine to set variables to be replaced at runtime such as {variable} or even {variable2}, or maybe even just look through some data:
{loop} {value1} is the first value.The Tempus-Project template-processor works with the backend to render html for the end user. This process has several steps and components that can get pretty complex. For the moment let's just review a few that can be used to generate web pages.
Views are the most basic interaction between the front-end and back-end. Inside of a controler, you can call a view in two ways:
You can think of components as a sort of front-end variable that can be filled in by the back-end before being send to the end-user. You can include components in all template parsing with a simple command:
Adding this to a controler will give access to that component's value in the rendering engine. For example:In some cases, you may want to hide or show text on a page conditionally. For example, you may have administrator controls on a commonly used page. Obviously you would like to hide those controls from regular users; even if you have safeguards to prevent them from performing any restricted actions.
This is where filters come in. They do exactly that, conditionally hide or show part of a page based on back-end logic. The admin example is so common, its already built in. If a user has the isAdmin permission on thier group, they will be able to see anything within the "ADMIN" tag:
Filters::add('member', '#{MEMBER}(.*?){/MEMBER}#is', (self::$isMember ? '$1' : ''), true); Filters::add('mod', '#{MOD}(.*?){/MOD}#is', (self::$isMod ? '$1' : ''), true); Filters::add('admin', '#{ADMIN}(.*?){/ADMIN}#is', (self::$isAdmin ? '$1' : ''), true);'#\[b\](.*?)\[/b\]#is' => '$1', '#\[p\](.*?)\[/p\]#is' => '
$1
', '#\[i\](.*?)\[/i\]#is' => '$1', '#\[u\](.*?)\[/u\]#is' => '$1', '#\[s\](.*?)\[/s\]#is' => '$1
',
'#\[color=(.*?)\](.*?)\[/color\]#is' => "$2",
'#\[img\](.*?)\[/img\]#is' => "$2", '#\(c\)#is' => '✔', '#\(x\)#is' => '✖', '#\(!\)#is' => '❕', '#\(\?\)#is' => '❔', '#\[list\](.*?)\[/list\]#is' => '
One of the pre-existing filters happens to be Issues. In the controller for this file, you should see a block that includes several examples of Issues. These issues are automatically added as individual components and hidden with the issues filter.
Issues::add( 'error', [ 'This is an error with multiple parts.' => [ 'Error 1', 'Error 2' ] ] ); Issues::add( 'error', 'This is a single error.' ); Issues::add( 'success', [ 'This is a success with multiple parts.' => [ 'Success 1', 'Success 2' ] ] ); Issues::add( 'success', 'This is a single success.' ); Issues::add( 'notice', 'This is a single notice.' ); Issues::add( 'info', 'This is a single info.' ); Filters::add('issues', '#{ISSUES}(.*?){/ISSUES}#is', (Issues::hasIssues() ? '$1' : ''), true); Components::set( 'NOTICE', $test ); Components::set( 'SUCCESS', $test ); Components::set( 'ERROR', $test ); Components::set( 'INFO', $test );