Reputation: 422
Is it possible to get the template parameters from one template into another template? And if so how? I am basically trying to reuse some parameters I have in my main template in one that I am doing for IE8 an less users.
Upvotes: 0
Views: 124
Reputation: 1873
Here is a much cleaner means to achieve the same thing. For the sample code I'm loading Joomla 3.2 included Protostar template's manifest file and retrieving the template color field.
jimport('joomla.filesystem.file');
$params = new JRegistry(JFile::read(JPATH_ROOT . '/templates/protostar/templateDetails.xml'));
$color = $params->get('templateColor');
Upvotes: 1
Reputation: 422
For anyone who comes across this in the future here is what I finally figure out how to do. If someone has a better solution, please post.
$db = JFactory::getDBO();
$sql = "SELECT params FROM `#__template_styles` WHERE `id` = 9"; //Set equal to template id
$db->setQuery($sql);
$db->query();
$row = $db->loadRow();
$json = $row[0];
$arrayExtract = json_decode($json, true);
extract($arrayExtract, EXTR_PREFIX_ALL, "dup");
//Note: this will add an underscore to end of dup
// in all my searching, I never saw it documented
// stumbled upon it by accident
//templateDetails.xml -> params
echo $dup_logoText . "<br>";
echo $dup_Address . "<br>";
I could see this being utilized for an intranet type situation, where one wanted to use the params from the main template in the intranet template, not just for the IE 8 workaround as was in my original question.
Upvotes: 0