1. Go to this page and download the library: Download vierwd/typo3-smarty library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
vierwd / typo3-smarty example snippets
// 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);
}
}
smarty
{capture assign=text}
<p>Lorem <b>ipsum</b> 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!</p>
{/capture}
{typoscript header='TypoScript Example' bodytext=$text CType=text}
lib.parseFunc_RTE >
10 < tt_content
{/typoscript}
html
<div class="csc-default">
<header class="csc-header"><h1>TypoScript Example</h1></header>
<p>Lorem <b>ipsum</b> 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!</p>
</div>
smarty
{capture assign=text}
<p>Lorem <b>ipsum</b> 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!</p>
{/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}
html
<div class="csc-default">
<header class="csc-header"><h2>TypoScript Example</h2></header>
<p>Lorem <b>ipsum</b> 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!</p>
</div>