Skip to content
hertsch edited this page May 17, 2014 · 6 revisions

kitCommands are very helpful and they can be placed everywhere within your php template, for example:

<div class="content">
    <?php
        // show the page content
        $template['cms']->page_content();
    ?>
    <div class="comments">
        <!-- enable comments -->
        ~~ Comments ~~
    </div>
</div>

This will work fine. The kitCommand will be executed after the template is completely executed and just before the page will be shown in the browser of the visitor.

You can speed up the process a little bit, if you execute the kitCommand just in place and at the same time as the template will be created, use $template['command']->execute():

<div class="content">
    <?php
        // show the page content
        $template['cms']->page_content();
    ?>
    <div class="comments">
        <?php
            // enable comments
            $template['command']->execute('Comments');                
        ?>
    </div>
</div>

Parameters for the kitCommand can be attached as array:

$template['command']->execute('comments', array(
        'rating' => false,
        'captcha' => false
    ));

You can also execute kitCommands within twig templates, use {{ command() }}:

<div class="content">
    {# show the page content #}
    {{ page_content() }}
    <div class="comments">
        {# enable comments #}
        {{ command('Comments',{'rating':false,'captcha':false}) }}
    </div>
</div>

Classic Service | Database Service