Last active
November 1, 2018 06:01
-
-
Save MichaelHabib/be0948e61c424be5ab6019a31093f005 to your computer and use it in GitHub Desktop.
October CMS : How to parse twig & bracket variables stored in a string or a field ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// parsing twig | |
$theme = Cms\Classes\Theme::getActiveTheme(); | |
if(($stringContainingTwig = $this['page']['meta_title']) !== null ){ | |
$page_meta_title = Twig::parse($stringContainingTwig, [ | |
'varName' => "variable value!", | |
'separator' => $theme->title_separator ?: ' _ ' , | |
'title' => $this['page']['title'], | |
'business_name' => $theme->business_name, | |
]); | |
}else{ | |
$page_meta_title = $this['page']['title'].' - '.$theme->business_name; | |
} | |
$this['page_meta_title'] = $page_meta_title; | |
// parsing bracket | |
// ToDo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment