Magento - $this->getSkinUrl() returns Wrong theme in homepage
I use a template with 3 columns in homepage, in my file right_col.phtml I use "$this->getSkinUrl()" and that returns me the wrong 开发者_开发知识库theme: /default/default/ instead of /default/my_second_theme, but it works good in all other pages.
How can I fix this problem to get the good theme??
Thanks a lot.
Also make sure that the asset actually exists (or that you specify an existing path). If an asset is not found in any theme, Magento will always use default/default as the resulting skin path.
Check the CMS page for the home page, go to the Design tab, and make sure that you didn't set the "Custom Theme" to something that is overriding the theme that you want to use.
Check the $argument you are passing and verify that the target file actually exists. getSkinUrl() does more than just generate the proper URL, it also verifies that the file exists. If it doesn’t find the file within the store’s /default/my_second_theme folder, it will revert to /default.
Refer to: http://www.nvncbl.com/2009/10/magento-this-getskinurl-wrong-template/
I have used this to solve it :
if (Mage::app()->getStore()->getCode()=='deutsch') {
Mage::getDesign()->setTheme('deutsch');
}
It works good now ;)
精彩评论