Download the PHP package everest-php/razr without Composer
On this page you can find all versions of the php package everest-php/razr. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download everest-php/razr
More information about everest-php/razr
Files in everest-php/razr
Package razr
Short Description Razr - The powerful PHP template engine
License MIT
Homepage http://pagekit.com
Informations about the package razr
Razr - The powerful PHP template engine
Razr is a powerful PHP template engine for PHP, whose syntax was inspired by ASP.NET Razor.
Usage
Render a template:
Render a template file with caching:
Syntax
The Razr syntax uses @ as special character. It is used to indicate a dynamic statement for the template engine. Within the @() notation you may use regular PHP. The following statements are supported.
Echo data
Use the @() notation to echo any PHP data with escaping enabled by default.
Example
Output
Echo raw data
Use the @raw() directive to output any PHP data without escaping.
Example
Output
Variables
You can access single variables and nested variables in arrays/objects using the following dot . notation.
Example
Output
Set variable values
Example
Output
Conditional control structures
Use @if, @elseif, @else for conditional control structures. Use any boolean PHP expression.
Example
Output
Loops
You can use loop statements like foreach and while.
Include
Extract reusable pieces of markup to an external file using partials and the @include directive. You can pass an array of arguments as a second parameter.
Example
partial.razr:
Output
Extending templates with blocks
Use the @block directive to define blocks inside a template. Other template files can extend those files and define their own content for the defined blocks without changing the rest of the markup.
Example
parent.razr:
child.razr:
Output