Pimcore Templates
Templates define the visual structure of a document and control which parts of a page are editable by editors in Pimcore Studio. A template combines standard HTML/Twig markup with Pimcore Editables, placeholders that turn into interactive input widgets (text fields, WYSIWYG editors, image pickers, etc.) when an editor opens the page in Pimcore Studio's edit mode.
Beyond simple content fields, special editables like Block and Areablock give editors the ability to make structural changes to the page, adding, removing, and reordering content sections without touching the template code itself.
Templates are standard Twig files located in
templates/[controller]/[action].html.twig, while
Symfony's directory conventions
also work.
Check the Pimcore Demo for practical examples.
Rendering Templates
Use Symfony's #[Template] attribute or render the view directly from your controller:
<?php
namespace App\Controller;
use Pimcore\Controller\FrontendController;
use Symfony\Bridge\Twig\Attribute\Template;
use Symfony\Component\HttpFoundation\Response;
class MyController extends FrontendController
{
/**
* The attribute will resolve the defined view
*/
#[Template('content/default.html.twig', vars: ['param1' => 'value1'])]
public function attributeAction(): void
{
}
public function directRenderAction(): Response
{
return $this->render('my/custom/action.html.twig', ['param1' => 'value1']);
}
}
You can also assign a template directly in a document's settings in Pimcore Studio. That template is used for auto-rendering when the controller does not return a response. See MVC in Pimcore for details on how documents resolve their controller and template.
Editables
Editables are the bridge between templates and Pimcore Studio. In the template, they look like Twig function calls. In Pimcore Studio's edit mode, they render as interactive input widgets. On the frontend, they output the content the editor has entered:
<h1>{{ pimcore_input('headline') }}</h1>
{{ pimcore_wysiwyg('content') }}
{{ pimcore_select('type', { reload: true, store: [["video","video"], ["image","image"]] }) }}
Pimcore provides editables for text, rich text, images, links, relations, dates, and more. See Editables for the full reference.
For structural flexibility, Block lets editors repeat a set of editables (e.g., a list of feature cards), while Areablock lets them compose pages from predefined content blocks called "bricks."
If you store an editable in a variable, pipe it through the raw filter to prevent HTML escaping:
{% set content = pimcore_wysiwyg('content') %}
{{ content|raw }}
Next Steps
- Template Inheritance and Layouts - define reusable page structures
- Twig Extensions - Pimcore's Twig functions, filters, and tags
- Editables - all available editable types
- Thumbnails - image handling in templates