-
-
Save akroii/b56e286db3cbc5f27f9038d4df665315 to your computer and use it in GitHub Desktop.
Establishing an database connection
This file contains 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
/** @var PageModel $objPage */ | |
global $objPage; | |
$this->import('Database'); | |
$vars = array(); | |
// Get the global theme variables | |
$objTheme = $this->Database->prepare("SELECT tl_theme.vars FROM tl_theme, tl_layout WHERE tl_theme.id=tl_layout.pid AND tl_layout.id=?") | |
->limit(1) | |
->execute($objPage->layoutId); | |
if ($objTheme->vars != '' && \is_array(($tmp = StringUtil::deserialize($objTheme->vars)))) | |
{ | |
foreach ($tmp as $v) | |
{ | |
// remove $ for backwards compatability with existing entries on the key | |
$vars[str_replace('$', '', $v['key'])] = $v['value']; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment