Helpers (Available View Methods)

Skip to end of metadata
Go to start of metadata

$this->inc(mixed $document, [array $params])

Use $this->inc() to include documents inside of views, for example a snippet.
This is useful for footers, headers, navigations, sidebars, ...

Arguments

$document can be either an ID, a path or even the Document object itself
$params is optional and should be an array with key value pairs like in $this->action() from ZF.

 <!-- include path -->
<?= $this->inc("/shared/boxes/buttons") ?>

<!-- include ID -->
<?= $this->inc(256) ?>

<!-- include object -->
<?php

$doc = Document::getById(477);
echo $this->inc($doc, array(
    "param1" => "value1"
));

?>

$this->template(string $path, [array $params])

This method is designed to include an other template directly, without calling an action.

 <?php $this->template("includes/footer.php") ?>

<!-- with parameters -->
<?php $this->template("includes/somthingelse.php", array(
    "param1" => "value1"
)) ?>

$this->getParam(string $key)

Get's a parameter (get, post, .... ), it's an equivalent to $this->_getParam() in the controller action.

<?php if ($this->param1) { ?>
    Some Output
<?php } ?>

$this->cache(string $key, [int $lifetime])

This is an implementation of a direct in-template cache. You can use this to cache some parts directly in the template, independend of the other global defineable caching functionalities. This can be useful for templates which need a lot of calculation or require a huge amount of objects.
If you define no lifetime the behavior is like the outputcache, so if you make any change in pimcore, the cache will be flushed. When specifing a lifetime this is independend from changes in the CMS.

 <?php if(!$this->cache("test_cache_key", 60)->start()) { ?>
    <h1><?= $this->input("headline", array("width" => 670)); ?></h1>
    <?= microtime() ?>
    <?php $this->cache("test_cache_key")->end() ?>
<?php } ?>

$this->glossary()

Please see the glossary documentation.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.