문제

My package name is 'company' and my theme name is 'web', and I have another package named 'system' whose theme is named 'component'.

Run time is from the Block file but I want to set that theme and package from the front-end side in magento2.

올바른 솔루션이 없습니다

다른 팁

If you want to Set package and theme at run time in magento simply use this code snippet.

  1. create one function ex. changeTheme('Theme-name'); and run this function with your requirement

  2. add this function in your head.phtml after php start.

     function changeTheme($themeName)
     {
       Mage::getDesign()->setArea('frontend') //Area (frontend|adminhtml)
                        ->setPackageName('default') //Name of Package
                        ->setTheme($themeName); // Name of theme
     }
    

enjoy :)

You can set your theme programmatically by using the following code :

Mage::getDesign()->setArea('frontend') //Area (frontend|adminhtml)
    ->setPackageName('default') //Name of Package
    ->setTheme('modern'); // Name of theme

http://roshanlal.in/magento/magento-programmatically-change-theme/#more-193

You can write below code in action to set package and theme for the action:

Mage::getDesign()->setArea(‘frontend’) //Area (frontend|adminhtml)
    ->setPackageName(‘default’) //Name of Package
    ->setTheme(‘modern’); // Name of theme

You may write the code in layout handler to set theme:

<reference name=”root”>
    <action method=”setTheme”>
        <theme>modern</theme>
    </action>
</reference>

Change page layout:

<reference name=”root”>
    <action method=”setTemplate”>
        <template>page/1column.phtml</template>
    </action>
</reference>

I hope it will surely help you.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top