?
Referenced as Pull Request for: # 6097
avatar nickweavers
nickweavers
16 Feb 2015

Steps to reproduce the issue

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>');
}

Expected result

The component should render its output into the template you used for <alternative_template>.

Actual result

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>.

System information (as much as possible)

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.

Additional comments

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.

avatar nickweavers nickweavers - open - 16 Feb 2015
avatar nickweavers nickweavers - change - 16 Feb 2015
The description was changed
avatar nickweavers nickweavers - change - 16 Feb 2015
The description was changed
avatar Bakual
Bakual - comment - 16 Feb 2015

@mbabker I think you had somes PRs which dealt with changing the application classes. Maybe you have a clue here? :smile:

avatar mbabker mbabker - reference | - 16 Feb 15
avatar brianteeman
brianteeman - comment - 16 Feb 2015

See #6097


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6096.
avatar zero-24 zero-24 - close - 16 Feb 2015
avatar brianteeman brianteeman - change - 16 Feb 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-02-16 13:59:11
Closed_By brianteeman
avatar brianteeman brianteeman - change - 16 Feb 2015
Closed_Date 2015-02-16 13:59:11 2015-02-16 13:59:18
avatar brianteeman brianteeman - close - 16 Feb 2015
avatar brianteeman brianteeman - close - 16 Feb 2015
avatar nickweavers
nickweavers - comment - 16 Feb 2015

Great job. Thanks to all involved.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6096.
avatar zero-24 zero-24 - change - 7 Jul 2015
Labels Added: ?

Add a Comment

Login with GitHub to post a comment