picea/docs/00-intro.md

1.2 KiB

Picea

Welcome to the official Picea documentation.

This library offers modern features from templating language, while simply generating normal PHP after compilation, such as view inheritance, definable blocks, 'or' token on unrunned looped, etc...

Picea uses the same delimiters that Twig uses, which are {% %}, {{ }} and {# #}.

The first {% %} is used for most control structure and extensions.

The {{ }} delimiter is used to echo escaped content in a page. (see 01-echoing)

The {# #} is exclusively used as a comment enclosure. (see 01-comment)

Quick start

Render a simple Picea view:

$picea = new Picea\Picea();
$picea->renderHtml('view/path/hello_world');

And the view content could look like:

path/hello_world

<!DOCTYPE html>
<html> 
    <head>
        <title>Picea's simple </title>
    </head>
    <body>
        <nav>
            {% foreach $navigation as $navItem %}
                <a href="{% route $navItem->route %}" title="{{ $navItem->description }}">
                    {{ $navItem->caption }}
                </a>
            {% endforeach %}
        </nav>
    
        {{ $someText }}
    </body>
</html>