$date = date("Y-m-d"); $string = "Today's date is {date}"; $result = \Contao\Controller::replaceInsertTags($string); echo $result; // Today's date is 2022-06-08
$person = array( 'name' => 'John Doe', 'age' => 30 ); $string = "My name is {person:name} and I am {person:age} years old"; $result = \Contao\Controller::replaceInsertTags($string, false, false, array('person' => $person)); echo $result; // My name is John Doe and I am 30 years old
$string = "Welcome to {config:site_name}"; $result = \Contao\Controller::replaceInsertTags($string); echo $result; // Welcome to My WebsiteThe Contao Controller class is part of the Contao CMS (Content Management System) package library.