Forcing template on component with setTemplate() - Joomla! Forum - community, help and support
hi,
i have specific template(beez3) want use component while maintaining template default.
it works without problem when adding following lines @ top of php file of view of component.
$app = jfactory::getapplication();
$params = array();
$app->settemplate('beez3');
now issue there 2 styles specific templates.
here example :
-beez3 template id 4
-beez3 template id 5
how enter id in settemplates() argument correct version of template?
thank time,
i have specific template(beez3) want use component while maintaining template default.
it works without problem when adding following lines @ top of php file of view of component.
$app = jfactory::getapplication();
$params = array();
$app->settemplate('beez3');
now issue there 2 styles specific templates.
here example :
-beez3 template id 4
-beez3 template id 5
how enter id in settemplates() argument correct version of template?
thank time,
i given solution forum : should work :
$app = jfactory::getapplication();
$db = jfactory::getdbo();
$query = $db->getquery(true)
->select('template, params')
->from('`#__template_styles`')
->where('`id`= 7');
$db->setquery($query);
$row = $db->loadobject();
$app->settemplate($row->template, (new jregistry($row->params)));
$app = jfactory::getapplication();
$db = jfactory::getdbo();
$query = $db->getquery(true)
->select('template, params')
->from('`#__template_styles`')
->where('`id`= 7');
$db->setquery($query);
$row = $db->loadobject();
$app->settemplate($row->template, (new jregistry($row->params)));
Comments
Post a Comment