User tests: Successful: Unsuccessful:
…Template
$app = JFactory::getApplication();
$t=$app->getTemplate(true);
var_dump($t);
results in
object(stdClass)#582 (4) {
** ["id"]=>
string(2) "7"
["home"]=>
string(1) "1"**
["template"]=>
string(10) "protostar"
["params"]=>
object[....]
}
But after a setTemplate, the same call has a different type of result
$app = JFactory::getApplication();
$app->setTemplate('beez3',null);
$t=$app->getTemplate(true);
results in
object(stdClass)#865 (2) {
["template"]=>
string(10) "rt_anacron"
["params"]=>
..........
}
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
Category | ⇒ | Libraries |
Title |
|
I have tested this item
Cant reproduce the problem because of missing function.
Error:
´´´php
Fatal error: Call to undefined method JApplicationAdministrator::setTemplate() in /var/www/html/joomla-hc/administrator/components/com_test/test.php on line 11
´´´
Forgot @icampus, again. Sorry :(
You need to test this with the frontend, not the backend. As you correctly pointed out, the admin app doesn't have this API method but the frontend app does.
I have tested this item
I write a small system plugi that onAfterRoute() changes templates. Tested in the frontend:
$app = JFactory::getApplication();
$template = $app->getTemplate(true);
var_dump(expression)($template);
produces:
/Users/rkr/Development/Projects/joomla-cms-staging/plugins/system/forcetemplate/forcetemplate.php:16:
object(stdClass)[174]
public 'id' => string '7' (length=1)
public 'home' => string '1' (length=1)
public 'template' => string 'protostar' (length=9)
public 'params' =>
object(Joomla\Registry\Registry)[567]
protected 'data' =>
object(stdClass)[568]
public 'templateColor' => string '' (length=0)
public 'logoFile' => string '' (length=0)
public 'googleFont' => string '1' (length=1)
public 'googleFontName' => string 'Open+Sans' (length=9)
public 'fluidContainer' => string '0' (length=1)
public 'separator' => string '.' (length=1)
If I alter the plugin with this code:
$app = JFactory::getApplication();
$app->setTemplate('beez3',null);
$template = $app->getTemplate(true);
var_dump($template);
it produces:
/Users/rkr/Development/Projects/joomla-cms-staging/plugins/system/forcetemplate/forcetemplate.php:17:
object(stdClass)[550]
public 'template' => string 'beez3' (length=5)
public 'params' =>
object(Joomla\Registry\Registry)[560]
protected 'data' =>
object(stdClass)[561]
public 'separator' => string '.' (length=1)
Rel_Number | 0 | ⇒ | 8606 |
Relation Type | ⇒ | Pull Request for |
@AndyTheFactory Can you have a look at the unsuccessful tests and see if and where your code may need updating?
Can this PR be updated to be in sync with the current development branches and address the issues noted above?
Status | Pending | ⇒ | Information Required |
If this PR get no Response, it will be closed at 22. June 2017.
Status | Information Required | ⇒ | Closed - No Reply |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-06-22 03:55:46 |
Closed_By | ⇒ | franz-wohlkoenig |
closed as stated above.
Set to "closed" on behalf of @franz-wohlkoenig by The JTracker Application at issues.joomla.org/joomla-cms/8611
this is in regards to #8606