In a Joomla 3.3 site, add the following constructor to the top of a component and change to another template you have available that isn't the site default.
function __construct() {
parent::__construct();
$app = JFactory::getApplication();
$app->setTemplate('<alternative_template>');
}
The component should render its output into the template you used for <alternative_template>.
Under 3.3 the component will still render its output into the default site template. Under 2.5 it will use whatever template you used for <alternative_template>.
My website was migrated from 2.5.28 to 3.3 using the automatic migration option, and then all the DS constants in my custom component were replaced with '/' and the appropriate class names updated to include Legacy. The site uses custom templates throughout that were developed by me. It is hosted on a Rackspace managed cloud server behind a load-balancer. The web server runs under Ubuntu LTS 14.4, using Apache 2.4.7, PHP 5.5.9 and MySQL 5.6.19.
Note: I migrated from 2.5 to 3.3 so can't say if earlier subversions of 3 had the problem I describe .
JApplicationSite::setTemplate() stores the template name you give it into the JApplicationCms::template property, but in Joomla 3.3 the render method in the same class uses the getter to retrieve a property called theme, which the getter JApplicationWeb gets from its config property that is a registry object.
So between 2.5 and 3.3 I see there has been a change in the terminology used for template and a change in the way this information is stored and retrieved that hasn't been applied to JApplicationSite::setTemplate().
If I replace JFactory::getApplication('')->setTemplate() on my component with JFactory::getApplication()->set('theme', '') it works, so this is my workaround.
old report related to same problem http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=32757&start=0
it do not work, because JApplicationSite::setTemplate do not override
the template loaded on dispatch
See #6097
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-02-16 13:59:11 |
Closed_By | ⇒ | brianteeman |
Closed_Date | 2015-02-16 13:59:11 | ⇒ | 2015-02-16 13:59:18 |
Great job. Thanks to all involved.
Labels |
Added:
?
|
@mbabker I think you had somes PRs which dealt with changing the application classes. Maybe you have a clue here?