This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Daniel81
Daniel81

Hi,

Does anyone know how to output rendered/parsed TWIG syntax from the CodeEditor widget i.e variables, loops etc ?

Thanks in advance.

Daniel81
Daniel81

Figured it out :)

For anyone interested, you need to enable the Twig extension "template_from_string"

e.g

Event::listen('cms.page.beforeRenderPage', function($controller, $page) {

    $twig = $controller->getTwig();
    $twig->addExtension(new \Twig_Extension_StringLoader());
});

Hope this helps anyone with a similar need to mine :)

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.