Set package and theme at run time in magento2 -


my package name - company , theme name web. , have other package named system , theme package component.

run time block file want set theme , package front-end side in magento2.

any appreciated.

thanks in advanced.

if want set package , theme @ run time in magento use code snippet.

  1. create 1 function ex. changetheme('theme-name'); , run function requirement

  2. add function in 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 :)


Comments