Inserting CMS blocks in the iPhone Theme
Inserting CMS blocks in the iPhone Theme
How to show a CMS block in the mobile view?
By default, our iPhone Theme extension does not have a provision for inserting CMS content from the backend. But it is still possible to do so via minor code modifications.
The key of the method is to insert the block calls directly into the theme's template files.
Note, the blocks must be created prior to inserting them, as it is necessary to specify the exact block ID for every instance.
To insert a block into the home page only:
1. Navigate to the Magento root folder on your server, then open this file: app/design/frontend/aw_mobile/iphone/template/catalog/navigation/top.phtml
2. Insert the below code into the desired position:
<?php echo Mage::app()->getLayout()->createBlock('cms/block')->setBlockId('block_identifier')->toHtml(); ?>
where "block_identifier" is the ID of your block.
There are 5 available positions, see below for details:
#1. After <div id="home" class="header-nav current"> |
![]() |
3. Flush the store and browser cache, and check your page.
HINT: since the described method requires specifying the block ID, it may be handy to create empty CMS blocks, and insert the calls into all the available positions. In such case, if you ever need to show any content is a currently unused position, you will be able to just fill the existent block from the backend.
To insert a block into all the catalog pages:
1. Open file app/design/frontend/aw_mobile/iphone/template/page/1column.phtml
2. Insert the below code in the desired position
<?php
if (Mage::registry(AW_Mobile_Block_Catalog_Navigation::IS_NAVIGATION_PAGE)){
echo Mage::app()->getLayout()->createBlock('cms/block')->setBlockId('block_identifier')->toHtml();
}?>
where "block_identifier" is the ID of your block in Magento backend.
3. Flush store and browser cache, and check the page