Under the design tab of a CMS page in Magento's admin area, there is the option to specify a page layout. I have a few custom fields that I wish to display only on certain page layouts. How can I grab the name of the page layout so I can proceed with an if statement for displaying my custom fields? Thanks in advance!
2条回答 默认 最新
- duanche5149 2013-08-30 04:52关注
$root = Mage::app()->getLayout()->getBlock('root'); if ($root) { $rootTemplate = $root->getTemplate(); switch ($rootTemplate ) { case 'page/2column.phtml': // Do something. break; //etc. } }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报