default page need to show protostar and where you select beez3 for that menu item which need to show beez3 template.
When i turn off SEF from global configuration it's working Well.
both page showing default template (protostar) :(
PHP Built On Windows NT RANA-PC 6.2 build 9200 (Unknown Windows version Business Edition) i586
Database Version 5.5.36
Database Collation utf8_general_ci
PHP Version 5.4.27
Web Server Apache/2.4.9 (Win32) OpenSSL/0.9.8y PHP/5.4.27
WebServer to PHP Interface apache2handler
Joomla! Version Joomla! 3.3.0 Stable [ Ember ] 30-April-2014 14:00 GMT
Joomla! Platform Version Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
User Agent Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36
maybe you think why it's need it for me? actually i want use it my own plugin for get current template directory.
same problem happen when i installed those plugin who use getTemplate() function there plugin.
some same issue plugin they used getTemplate method:
http://www.joomshaper.com/joomla-templates/helix-ii
http://www.seblod.com/
go to any plugin and write: $current_template = JFactory::getApplication()->getTemplate(); for example go to: plugins/system/debug/debug.php and write this code here.
where exactly?
you do it in the plugin file but outside of the plugin class, or you do it in some event method?
There can be different depend on the app state, when you tried get the template.
And I can add that there was some bug with App get/set template on old joomlacode tracker ... but cannot find..
I wouldn't expect it to work in the constructor. The constructor is executed before the routing is done and thus the template isn't set correctly yet.
You need to do this in the onAfterRoute event or later.
Closing this as expected behaviour.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2014-11-10 07:38:39 |
I think you not clear about it or i could not understand you.
actually i need to include a file in plugin from current template so it's need to declare on top of the plugin file and it's working well until SEF enable.
my example code:
// Import the shortcodes override from current template if the file exists
$shortcode_template = JPATH_THEMES.'/'.JFactory::getApplication()->getTemplate().'/html/plg_bdthemes_shortcodes/shortcodes.php';
if (file_exists($shortcode_template)) {
require_once($shortcode_template);
}
it's perfectly work without SEF and when i enable SEF it's not work anymore because template has been changed to default template.
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5076.
Have a look at http://docs.joomla.org/J3.x:Creating_a_Plugin_for_Joomla how to write a plugin.
The important thing is to run your code withing an event method.
In your case, you need to use a system plugin event: http://docs.joomla.org/Plugin/Events/System
Currently, you're code runs basically in the onAfterInitialise
event, because there the plugins are loaded for the first time.
When you have SEF enabled, the routing is the process where the Itemid is determined and from there the active template is derived. When you have SEF disabled, there is no need for that step because the Itemid is already present plain in the URL.
That explains why your code works without SEF and doesn't work with SEF.
As explained, just put your code into an event where the routing has been completed and the Itemid is present. The earliest event for that is the onAfterRoute
event. There are also other events possible: http://docs.joomla.org/Plugin/Events/System.
Labels |
Added:
?
|
I first suggest you test on staging and not on 3.3.0 which is far away back (we are at 3.3.7 going on 3.4.0)