You are here

README.txt in Mobile Switch Block 7.2

Same filename in this branch
  1. 7.2 README.txt
  2. 7.2 templates/mobile_jquery/README.txt
Same filename and directory in other branches
  1. 6 README.txt
  2. 7 README.txt
Mobile Switch Block module, README.txt

Extends the Mobile Switch module with an theme switch block.

The block content provides a link to manually switch the current theme to
the mobile or desktop theme.

HOW IT WORKS

The module uses a cookie to store the theme was changed to. This works with
anonymous visitors and logged in users.

DEPENDENCIES

Drupal 7.
Mobile Switch module - http://drupal.org/project/mobile_switch.

INSTALL

1)
Copy the Mobile Switch Block folder to the modules folder in
your installation. Usually this is sites/all/modules.
Or use the UI and install it via admin/modules/install.

2)
In your Drupal site, enable the module under Administration -> Modules.
admin/modules

ADMINISTER

Administer blocks under:
Administration -> Structure
admin/structure/block

a)
Singlesite installation
Enable the 'Mobile Switch' block in the desktop theme.
Enable the 'Mobile Switch' block in the mobile theme.

b)
Multisite installation
Enable the 'Mobile Switch' blocks in both multisite themes.

c)
Singlesite, Multisite:
Configure one of the 'Mobile Switch' blocks.

Administer the option 'Block content' to display the block content. The same
configuration option exists in the Advanced module administration.

d)
Administer the Mobile Switch 'Advanced' settings under:
Administration -> Configuration -> User interface -> Mobile Switch
admin/config/user-interface/mobile-switch/advanced

- Configure the output of the switch content.

- Configure the 'Cookie lifetime' when needed.

Lifetime examples:

31536000 - 1 year (default)
2628000  - 30 days
604800   - 1 week
86400    - 24 hours

- Use the switch block only on large mobile devices.

Enable the option 'Non-tablet usage'.

DEVELOPMENT

Don't forget to take a look at the 'Development' funtions in the Mobile Switch
module settings.

Development with Mobile Switch Block.

1)
The module provides the system variable:

theme_cookie

The default value of this variable is FALSE. If the theme switch cookie
exists the value can be 'standard' or 'mobile'.
If used the operationg mode redirect the cookie values can be
'standard-rm' or 'mobile-rm'.

2)
Use the block content. Example PHP code to do this:


print mobile_switch_block_get_block_content();
In this use case, you ensure that the switch link content appears only with mobile devices. THEMING - Module template The module comes with a template file, included in the module folder. mobile-switch-block-content.tpl.php Is used for the switch content - the switch link and the switch message. - Use of the template This requires that there is a mobile-switch-block-content.tpl.php template in the desktop and/or mobile theme folder. - Switch link without menu bullet Remove in the template/s the class 'leaf' from the list tag.

<li class="even first last">
This will work with most themes and is recommended rather than an additional CSS formatting. - Usage with a 'Mobile jQuery' theme Mobile jQuery Theme - http://drupal.org/project/mobile_jquery To obtain a 'Mobile jQuery' like output of the switch link, create a template file for the Mobile jQuery sub-theme from the desktop template file 'mobile-switch-block-switch-content.tpl.php' with the same name and put this new template file in the 'templates' folder. Example path for the new Mobile jQuery sub-theme template file: sites/all/themes/your_mobile_jquery_sub_theme/templates/ In the new template file replace the code

<?php if ($switch_message): ?>
  <?php print $switch_message ?>
<?php endif;?>
<ul class="menu clearfix">
  <li class="leaf even first last">
    <?php print $switch_link ?>
  </li>
</ul>
with the following code

<?php print $content ?>
It is therefore possible to use different templates in the desktop and mobile Theme. Note: Take a look at the Mobile Switch Block module folder templates/mobile_jquery.

File

README.txt
View source
  1. Mobile Switch Block module, README.txt
  2. Extends the Mobile Switch module with an theme switch block.
  3. The block content provides a link to manually switch the current theme to
  4. the mobile or desktop theme.
  5. HOW IT WORKS
  6. The module uses a cookie to store the theme was changed to. This works with
  7. anonymous visitors and logged in users.
  8. DEPENDENCIES
  9. Drupal 7.
  10. Mobile Switch module - http://drupal.org/project/mobile_switch.
  11. INSTALL
  12. 1)
  13. Copy the Mobile Switch Block folder to the modules folder in
  14. your installation. Usually this is sites/all/modules.
  15. Or use the UI and install it via admin/modules/install.
  16. 2)
  17. In your Drupal site, enable the module under Administration -> Modules.
  18. admin/modules
  19. ADMINISTER
  20. Administer blocks under:
  21. Administration -> Structure
  22. admin/structure/block
  23. a)
  24. Singlesite installation
  25. Enable the 'Mobile Switch' block in the desktop theme.
  26. Enable the 'Mobile Switch' block in the mobile theme.
  27. b)
  28. Multisite installation
  29. Enable the 'Mobile Switch' blocks in both multisite themes.
  30. c)
  31. Singlesite, Multisite:
  32. Configure one of the 'Mobile Switch' blocks.
  33. Administer the option 'Block content' to display the block content. The same
  34. configuration option exists in the Advanced module administration.
  35. d)
  36. Administer the Mobile Switch 'Advanced' settings under:
  37. Administration -> Configuration -> User interface -> Mobile Switch
  38. admin/config/user-interface/mobile-switch/advanced
  39. - Configure the output of the switch content.
  40. - Configure the 'Cookie lifetime' when needed.
  41. Lifetime examples:
  42. 31536000 - 1 year (default)
  43. 2628000 - 30 days
  44. 604800 - 1 week
  45. 86400 - 24 hours
  46. - Use the switch block only on large mobile devices.
  47. Enable the option 'Non-tablet usage'.
  48. DEVELOPMENT
  49. Don't forget to take a look at the 'Development' funtions in the Mobile Switch
  50. module settings.
  51. Development with Mobile Switch Block.
  52. 1)
  53. The module provides the system variable:
  54. theme_cookie
  55. The default value of this variable is FALSE. If the theme switch cookie
  56. exists the value can be 'standard' or 'mobile'.
  57. If used the operationg mode redirect the cookie values can be
  58. 'standard-rm' or 'mobile-rm'.
  59. 2)
  60. Use the block content. Example PHP code to do this:
  61. @code
  62. print mobile_switch_block_get_block_content();
  63. @endcode
  64. In this use case, you ensure that the switch link content appears only
  65. with mobile devices.
  66. THEMING
  67. - Module template
  68. The module comes with a template file, included in the module folder.
  69. mobile-switch-block-content.tpl.php
  70. Is used for the switch content - the switch link and the switch message.
  71. - Use of the template
  72. This requires that there is a mobile-switch-block-content.tpl.php template
  73. in the desktop and/or mobile theme folder.
  74. - Switch link without menu bullet
  75. Remove in the template/s the class 'leaf' from the list tag.
  76. @code
  77. @endcode
  78. This will work with most themes and is recommended rather than an additional
  79. CSS formatting.
  80. - Usage with a 'Mobile jQuery' theme
  81. Mobile jQuery Theme - http://drupal.org/project/mobile_jquery
  82. To obtain a 'Mobile jQuery' like output of the switch link, create a
  83. template file for the Mobile jQuery sub-theme from the desktop template file
  84. 'mobile-switch-block-switch-content.tpl.php' with the same name and put this
  85. new template file in the 'templates' folder. Example path for the new
  86. Mobile jQuery sub-theme template file:
  87. sites/all/themes/your_mobile_jquery_sub_theme/templates/
  88. In the new template file replace the code
  89. @code
  90. @endcode
  91. with the following code
  92. @code
  93. @endcode
  94. It is therefore possible to use different templates in the desktop and
  95. mobile Theme.
  96. Note:
  97. Take a look at the Mobile Switch Block module folder
  98. templates/mobile_jquery.