-
Notifications
You must be signed in to change notification settings - Fork 1
kitCommand Service
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>
- If you spot a typo or want to contribute an article, a how-to or a tip, feel free to edit the Wiki directly
- If you you have any questions, please visit the phpManufaktur Support Forum
This Documentation is part of the kitFramework Project
© 2014 by phpManufaktur, kitFramework and TemplateTools are published under MIT license.