Hello All, i just had a look into extending a module for usage in the mobile theme, and somehow I cannot find a way to manage this. It seems quite impossible to me to write a module that just installs and works for mobile and desktop.
I read the section in documentation "Adding complete module support for mobile": "Due to changes to template files in the mobile theme, some modules might not work with a mobile theme from the get-go. However it is possible to get modules working for the theme without needing to patch or alter the module. You can add specific blocks for modules in a theme switcher, which allows for module developers to have different module looks on mobile devices. With this, you don't need to make additional patches for the module itself, when it can be added to module switcher." This might be useful for the Shop-Owner, the module developer does not want to change the theme switcher, but have all changes in the module itself. "To have an example of how to make a module look differently on mobile devices, look at PayPal implementation. For any shops using the PayPal module, the new mobile theme switcher has changes for PayPal, insuring that module works as well as it does in the desktop theme. Edit the mobile theme switcher metadata.php, located in /modules/oe/oethemeswitcher, override blocks like this: 'blocks' => array( . array('template' => 'page/checkout/payment.tpl', 'block'=>'mb_select_payment', 'file'=>'views/mobile/blocks/oepaypalpaymentselector.tpl'), ), Use mb_ prefix for block name, so it's clear that this block is for mobile." Paypal-like implementation inside the theme switcher is not an option for other modules. Even the paypal module seems to leave that road and has the blocks inside the module itself. "Change the desired blocks (for example select_payment) name to have prefix mb_ (mb_select_payment) where you want blocks to be replaced in theme files." I looked in the template, there are already some blocks prefixed with mb_, and these are the blocks paypal uses. So if I want to use another block in my own module, it looks like I'm supposed do the same and edit the theme files, and this prevents easy installation and might break other modules that use the blocks without prefix. "Adding desired mobile device functionality in other ways: You can add different looks and feels for your module in another way. You can use getActiveThemeId() method to get the active theme, and then add desired functionality for that." In theme switcher you have the possibility to enter another theme name in module options, so one can't rely on the theme id "mobile". All in all I don't see how extending mobile theme with own blocks is possible without manually changing files. When I saw you could prefix mobile blocks with mb, at first I thought this would already be possible for all blocks, maybe this would be a solution to prepend mb_ to all blocks in mobile theme so they are always different than the desktop ones, or maybe this could be done by the theme switcher in a transparent way, so that block "base_js" would work in desktop and mobile, but if "mb_base_js" is additionally specified, this would point to the block "base_js" in mobile theme. Regards, Frank Zunderer _______________________________________________ dev-general mailing list dev-general@lists.oxidforge.org http://dir.gmane.org/gmane.comp.php.oxid.general