PHPackages                             vierwd/typo3-smarty - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. vierwd/typo3-smarty

ActiveTypo3-cms-extension[Templating &amp; Views](/categories/templating)

vierwd/typo3-smarty
===================

Use Smarty in Templates instead of Fluid

10.2.0(2y ago)28.8k↓23.1%1MITPHPPHP &gt;=7.2.0CI failing

Since Nov 18Pushed 1mo ago4 watchersCompare

[ Source](https://github.com/4wdmedia/vierwd_smarty)[ Packagist](https://packagist.org/packages/vierwd/typo3-smarty)[ RSS](/packages/vierwd-typo3-smarty/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (62)Used By (1)

TYPO3 Smarty Extension [![Build Status](https://camo.githubusercontent.com/63149b10ef5653610ad1e92b2f2202ab4b8173b0019f2c42e706900b721dd1d8/68747470733a2f2f7472617669732d63692e636f6d2f3477646d656469612f7669657277645f736d617274792e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/4wdmedia/vierwd_smarty)
========================================================================================================================================================================================================================================================================================================================

[](#typo3-smarty-extension-)

> Use [Smarty](http://www.smarty.net/) in your templates and extbase extensions.

Installation
------------

[](#installation)

Install using [composer](https://getcomposer.org/):

```
composer require 'vierwd/typo3-smarty'

```

### Usage in controllers

[](#usage-in-controllers)

To use smarty templates for your extension's actions, just extend the `Vierwd\VierwdSmarty\Controller\ActionController`. Your templates need to be at the same location as your Fluid templates used to be, but with the file extension `.tpl`.

#### Example

[](#example)

```
// Classes/Controller/BlogController.php
namespace Example\ExampleBlog\Controller;

class BlogController extends \Vierwd\VierwdSmarty\Controller\ActionController {
	/**
	 * @var \Example\ExampleBlog\Domain\Repository\PostRepository
	 * @TYPO3\CMS\Extbase\Annotation\Inject
	 */
	protected $postRepository;

	public function listAction() {
		$posts = $this->postRepository->findAll();
		$this->view->assign('posts', $posts);
	}
}
```

```
{* Resources/Private/Templates/Blog/List.tpl *}

{foreach $posts as $post}

		{$post->getTitle()}

		{$post->getContent()|escape|nl2p nofilter}

{/foreach}
```

### Pre-defined variables

[](#pre-defined-variables)

There are some variables, that are always available to your templates:

Variable NameContentscObjThe current ContentObject (instance of `TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer`)extensionPathThe path to your extension (`typo3conf/ext/example_blog/`)extensionName`ExampleBlog`pluginName`Pi1` (or whatever you defined in ext\_tables.php)controllerName`Blog`actionName`list`contextThe controllerContext (instance of `TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext`)requestThe current request (instance of `TYPO3\CMS\Extbase\MvcRequest`)formPrefixPrefix form fields need as name to automatically map form fields to argumentssettingsFlexform settings for the pluginframeworkSettingsTypoScript settings for `plugin.tx_exampleblog`typolinkServiceAn instance of `TYPO3\CMS\Frontend\Service\TypoLinkCodecService`TSFE`$TSFE` (instance of `TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController`)### Pre-defined smarty functions, blocks and modifiers

[](#pre-defined-smarty-functions-blocks-and-modifiers)

- translate
- uri\_resource
- uri\_action
- link\_action
- flashMessages
- nl2p
- email
- typolink
- typoscript
- fluid
- svg

### Power-Blocks: typoscript and fluid

[](#power-blocks-typoscript-and-fluid)

What's realy good about this extension is, that you can still use typoscript and fluid within your Smarty templates. That way you can ensure, that an element gets exactly the same HTML output as a normal content element like Text-with-images. If you write a form, it's also good to fallback to Fluid for some ViewHelpers.

#### Typoscript

[](#typoscript)

```
{capture assign=text}
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolorem, earum est reiciendis modi neque in veniam rerum deleniti et praesentium? Numquam, odit, itaque voluptate pariatur adipisci enim tempora ducimus dolor!
{/capture}

{typoscript header='TypoScript Example' bodytext=$text CType=text}
lib.parseFunc_RTE >
10 < tt_content
{/typoscript}
```

##### Output (Line-breaks added)

[](#output-line-breaks-added)

```

TypoScript Example
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolorem, earum est reiciendis modi neque in veniam rerum deleniti et praesentium? Numquam, odit, itaque voluptate pariatur adipisci enim tempora ducimus dolor!

```

The changes to the typoscript will not persist. That way you can remove `lib.parseFunc_RTE` in one TypoScript Block and still use it in another. It is also possible to use an array `data` for all arguments:

```
{capture assign=text}
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolorem, earum est reiciendis modi neque in veniam rerum deleniti et praesentium? Numquam, odit, itaque voluptate pariatur adipisci enim tempora ducimus dolor!
{/capture}

{$data=[
	CType => text,
	header => 'TypoScript Example',
	header_layout => 1,
	bodytext => $text
]}

{typoscript data=$data header_layout=2}
lib.parseFunc_RTE >
10 < tt_content
{/typoscript}
```

Notice, that parameters in the block-tag override array keys (in this example header\_layout):

##### Output (Line-breaks added)

[](#output-line-breaks-added-1)

```

TypoScript Example
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolorem, earum est reiciendis modi neque in veniam rerum deleniti et praesentium? Numquam, odit, itaque voluptate pariatur adipisci enim tempora ducimus dolor!

```

Using Smarty for the base template
----------------------------------

[](#using-smarty-for-the-base-template)

It is also possible to use Smarty for the base template of your website in your main TypoScript setup

```
page = PAGE
page.10 < plugin.tx_vierwdsmarty
page.10.settings {
	template = EXT:example_blog/Resources/Private/Templates/main.tpl

	typoscript.navigation < lib.navigation
	typoscript.footerNavigation < lib.footerNavigation
	typoscript.content < styles.content.get
	typoscript.logo < lib.logo
}

```

All entries in settings.typoscript will be parsed and will be available as variables in your template.

```
{* example_blog/Resources/Private/Templates/main.tpl *}

	{$logo nofilter}
	{$navigation nofilter}

	{$content nofilter}

{$footerNavigation nofilter}
```

Note the nofilter argument for Smarty. By default all variables will be escaped to prevent some XSS attacks.

Using Smarty for Menus
----------------------

[](#using-smarty-for-menus)

```
lib.navigation = HMENU
lib.navigation {
	entryLevel = 0

	1 = SMARTY
	1 {
		expAll = 1
		extensionName = vierwd_example
		template = Navigation/Main.tpl

		NO = 1
		ACT = 1
		IFSUB = 1
		ACTIFSUB = 1
	}

	2 < .1
	2.template = Navigation/Submenu.tpl
	3 < .2
}

```

This code block will load the templates at `typo3conf/ext/vierwd_example/Resources/Private/Templates/Navigation/` to render the navigation. Within the template you can iterate over your menu items and output the menu:

```

	{foreach $menu as $item}
		{$hasSubmenu = $menuObject->isSubMenu($item.uid)}
		{$isActive = $menuObject->isActive($item.uid)}

				{$item.nav_title|default:$item.title}

			{$menuObject->submenu($item.uid) nofilter}

	{/foreach}

```

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance59

Moderate activity, may be stable

Popularity26

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 99.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~63 days

Recently: every ~222 days

Total

61

Last Release

52d ago

Major Versions

2.11.0 → 10.0.02020-11-05

2.x-dev → 9.5.x-dev2021-09-13

9.5.x-dev → 10.1.02022-09-08

10.4.x-dev → 12.4.x-dev2025-01-29

11.5.x-dev → 13.4.x-dev2026-03-27

PHP version history (6 changes)2.2.0PHP &gt;=5.4.0

2.5.6PHP &gt;=5.5.0

3.0.0PHP &gt;=7.2.0

12.4.x-devPHP ^8.1.0

11.5.x-devPHP &gt;=7.4.0

13.4.x-devPHP ^8.2.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/31570fd9995c0f4bd2046957d8e043e8160b8acbfbb53ce560059f73fed7e4e6?d=identicon)[rvock](/maintainers/rvock)

---

Top Contributors

[![rvock](https://avatars.githubusercontent.com/u/209159?v=4)](https://github.com/rvock "rvock (281 commits)")[![UchihaMadara63](https://avatars.githubusercontent.com/u/96827336?v=4)](https://github.com/UchihaMadara63 "UchihaMadara63 (1 commits)")

---

Tags

extensionsmartytypo3

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/vierwd-typo3-smarty/health.svg)

```
[![Health](https://phpackages.com/badges/vierwd-typo3-smarty/health.svg)](https://phpackages.com/packages/vierwd-typo3-smarty)
```

###  Alternatives

[dirkpersky/typo3-rte-ckeditor-fontawesome

Adds the Fontawesome add-on to the CKEditor in TYPO3.

16147.9k](/packages/dirkpersky-typo3-rte-ckeditor-fontawesome)[templavoilaplus/templavoilaplus

Building kit for custom pages and content elements with individual fields, containers and backend layouts. Supporting drag'n'drop and multiple references.

2637.6k13](/packages/templavoilaplus-templavoilaplus)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
