You are here

README.txt in Mobile Switch 7.2

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

Provides various functionalities to develop mobile ready websites.

This readme is valid for the branch 7.x-2+.
For other branches and their versions, please read the appropriate
README.txt files.

The module allows to work with 4 different operating modes.

DEPENDENCIES

Drupal 7.
The Mobile Detect PHP class - http://mobiledetect.net.
Libraries API module, branch 2+, - http://drupal.org/project/libraries.

REQUIRED

Views module branch 3+ - http://drupal.org/project/views,
to work with the Views filter criteria 'Mobile switch'.

RECOMMENDED MODULES

Mobile Detect Import - sub-module of Mobile Switch.
Mobile Switch Panels - http://drupal.org/project/mobile_switch_panels.
Context Mobile Switch - http://drupal.org/project/context_mobile_switch.
Mobile Switch Block - http://drupal.org/project/mobile_switch_block.
Mobile Switch Blocks - http://drupal.org/project/mobile_switch_blocks.

Not all of these modules are useful in each operating mode.

HOW WORKS - OPERATING MODES

1) Do not use
Only the Mobile Detect PHP class will be loaded.

2) No theme switch - detect only
Work with a single site and a responsive theme.

3) No theme switch - redirect to website
Work with a multisite installation.

IMPORTANT: In this mode, define default themes in the setting.php files.

Please read the HELP.txt for an example setup for a shared content multisite.

4) A theme name
This is the operating mode 'theme switch'.
Work with a single site and two themes.

IMPORTANT: In this mode, do NOT define default themes in the setting.php files.

LIMITATION

- Caching

It is not possible to work with 'Cache pages for anonymous users'.

INSTALL

1)
Make sure that the library directory exists for Mobile Detect.

Typically and recommended, this is:

sites/all/libraries/Mobile_Detect

or

sites/default/libraries/Mobile_Detect
sites/example.com/libraries/Mobile_Detect

If this directory does not exist it should be created.

Note: The directory name Mobile_Detect is case sensitive.

Multisite installation

Execute this step only on the default site.

For a multisite with shared content is is required to install the
Mobile Detect class on the default multisite in sites/all/libraries.

Please read the HELP.txt.

2)
Download the Mobile Detect class file and install it as a library.

Exists the library directory from step 1 and exists the class file

Mobile_Detect.php (with exactly this name)

you can skip this installation step.

Note: The file name Mobile_Detect.php is case sensitive!

Download the class file optionally from

a) https://raw.github.com/serbanghita/Mobile-Detect/tags

or

b) https://raw.github.com/serbanghita/Mobile-Detect/master/Mobile_Detect.php

The download from b) usually provides a higher version of the
Mobile Detect class.
The Mobile Detect Import module uses the link b).

The result of proper installation of the Mobile Detect class as library:

sites/all/libraries/Mobile_Detect/Mobile_Detect.php

or

sites/default/libraries/Mobile_Detect/Mobile_Detect.php
sites/example.com/libraries/Mobile_Detect/Mobile_Detect.php

Ultimately, this structure must exist in order to find the
Libraries API the Mobile Detect class.

- Multisite installation

Execute this step only on the default site.

For a multisite with shared content is is required to install the
Mobile Detect class in sites/all/libraries/Mobile_Detect.

Read the HELP.txt.

3)
Copy the Libraries API 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.

Note:
Mobile Switch branch 2+ requires Libraries API 2+.

4)
Copy the Mobile Switch 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.

5)
Enable the modules

Important:
As first step, enable ONLY the Libraries API module!
As second step, enable the modules Mobile Switch and Mobile Detect Import.

Enable modules under Administration -> Modules.
admin/modules

UPDATE FROM 1 TO 2 BRANCH

1)
Visit the Mobile Switch administration and inspect the configuration
parameters.
Make sure that you can remember all the configuration details.

2)
Disable and uninstall Mobile Switch and if used, the
Mobile Switch Block module.

Disable and uninstall the Browscap module when it is no longer
necessary (by other modules, or for logging of user agents).

3)
Follow the steps described in the INSTALL section above.

Install and enable the Mobile Switch Block module if it was uninstalled
in the update step 2.

4)
Administer the Mobile Switch module and reconfigure all parameter
to the previous settings.

If again the Mobile Switch block module enabled in the update step 3,
then enable the block 'Mobile switch' in the desktop and mobile theme.

ADMINISTER

- Administer single site

This section only describes the administration when using
the operating mode 'theme switch'!

Other operating modes:
Not all settings are available in each operating mode.

To get extended informations about the operating mode 'redirect to website'
please read the HELP.txt.

1)
Administer themes under Appearance.
admin/appearance

Enable the prefered mobile theme (NOT use 'Enable and set default').
If the prefered mobile theme already enabled not use 'Set default'.

2)
Administer the Mobile Switch module under:
Administration -> Configuration -> User interface
admin/config/user-interface/mobile-switch

Choose your mobile theme.

If a theme used as mobile theme, their displayed informations on the
Appearance administration page are altered for better visualisation.

A Mobile Switch mobile theme is default not available in the maintenance mode.

- Mobile theme on administration pages

Configure the 'Administration usage' in the module 'Basic settings' to
enable the use of the mobile theme on administration pages.

- Mobile device prevention

It is possible to bypass the automatic switching to the mobile theme for
mobile devices.
This is useful, for example, to exclude large tablets for the theme
switching.

To use this,

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

enable the 'Use preventing' option and configure the user agent strings
for such devices.

To test this feature, without a real mobile device, it is a good
solution to use the desktop browser with a user agent switcher extension
and custom defined user agents.

- For the development of a web site

Administer the 'Development' settings under:
Administration -> Configuration -> User interface -> Mobile Switch
admin/config/user-interface/mobile-switch/development

a) Enable/disable the 'Developer modus'.

If a desktop mobile emulator not detected from Mobile Detect it is
possible to configure additional user agents.

b) Enable/disable desktop browser usage of the mobile theme.

3)
Administer the Mobile Detect Import module.

See README.txt of the module.

- Administer shared content multisite

For a complete administration of both sites (the desktop and the mobile site)
with all aspects of the configuration, you need two browsers (on desktop and
mobile device) or a browser with a user-agent switcher on your device.
You can emulate the mobile device with the 'Opera Mobile Emulator'.

DEVELOPMENT

Development with Mobile Switch.

Possible is the usage of the


mobile_switch_mobile_detect();
function. Please read the inline code documentation of this function. Full access to the loaded Mobile Detect PHP class:
global $msw_detect;
$msw_detect
  ->isMobile();
$msw_detect
  ->isTablet();
The loaded class is also available in the operating mode 'Do not use'. MODULE DEVELOPMENT The module is only tested in a Apache web server environment. EXTERNAL RECOURCES Mobile Emulators & Simulators: The Ultimate Guide http://www.mobilexweb.com/emulators

File

README.txt
View source
  1. Mobile Switch module, README.txt
  2. Provides various functionalities to develop mobile ready websites.
  3. This readme is valid for the branch 7.x-2+.
  4. For other branches and their versions, please read the appropriate
  5. README.txt files.
  6. The module allows to work with 4 different operating modes.
  7. DEPENDENCIES
  8. Drupal 7.
  9. The Mobile Detect PHP class - http://mobiledetect.net.
  10. Libraries API module, branch 2+, - http://drupal.org/project/libraries.
  11. REQUIRED
  12. Views module branch 3+ - http://drupal.org/project/views,
  13. to work with the Views filter criteria 'Mobile switch'.
  14. RECOMMENDED MODULES
  15. Mobile Detect Import - sub-module of Mobile Switch.
  16. Mobile Switch Panels - http://drupal.org/project/mobile_switch_panels.
  17. Context Mobile Switch - http://drupal.org/project/context_mobile_switch.
  18. Mobile Switch Block - http://drupal.org/project/mobile_switch_block.
  19. Mobile Switch Blocks - http://drupal.org/project/mobile_switch_blocks.
  20. Not all of these modules are useful in each operating mode.
  21. HOW WORKS - OPERATING MODES
  22. 1) Do not use
  23. Only the Mobile Detect PHP class will be loaded.
  24. 2) No theme switch - detect only
  25. Work with a single site and a responsive theme.
  26. 3) No theme switch - redirect to website
  27. Work with a multisite installation.
  28. IMPORTANT: In this mode, define default themes in the setting.php files.
  29. Please read the HELP.txt for an example setup for a shared content multisite.
  30. 4) A theme name
  31. This is the operating mode 'theme switch'.
  32. Work with a single site and two themes.
  33. IMPORTANT: In this mode, do NOT define default themes in the setting.php files.
  34. LIMITATION
  35. - Caching
  36. It is not possible to work with 'Cache pages for anonymous users'.
  37. INSTALL
  38. 1)
  39. Make sure that the library directory exists for Mobile Detect.
  40. Typically and recommended, this is:
  41. sites/all/libraries/Mobile_Detect
  42. or
  43. sites/default/libraries/Mobile_Detect
  44. sites/example.com/libraries/Mobile_Detect
  45. If this directory does not exist it should be created.
  46. Note: The directory name Mobile_Detect is case sensitive.
  47. Multisite installation
  48. Execute this step only on the default site.
  49. For a multisite with shared content is is required to install the
  50. Mobile Detect class on the default multisite in sites/all/libraries.
  51. Please read the HELP.txt.
  52. 2)
  53. Download the Mobile Detect class file and install it as a library.
  54. Exists the library directory from step 1 and exists the class file
  55. Mobile_Detect.php (with exactly this name)
  56. you can skip this installation step.
  57. Note: The file name Mobile_Detect.php is case sensitive!
  58. Download the class file optionally from
  59. a) https://raw.github.com/serbanghita/Mobile-Detect/tags
  60. or
  61. b) https://raw.github.com/serbanghita/Mobile-Detect/master/Mobile_Detect.php
  62. The download from b) usually provides a higher version of the
  63. Mobile Detect class.
  64. The Mobile Detect Import module uses the link b).
  65. The result of proper installation of the Mobile Detect class as library:
  66. sites/all/libraries/Mobile_Detect/Mobile_Detect.php
  67. or
  68. sites/default/libraries/Mobile_Detect/Mobile_Detect.php
  69. sites/example.com/libraries/Mobile_Detect/Mobile_Detect.php
  70. Ultimately, this structure must exist in order to find the
  71. Libraries API the Mobile Detect class.
  72. - Multisite installation
  73. Execute this step only on the default site.
  74. For a multisite with shared content is is required to install the
  75. Mobile Detect class in sites/all/libraries/Mobile_Detect.
  76. Read the HELP.txt.
  77. 3)
  78. Copy the Libraries API folder to the modules folder in your installation.
  79. Usually this is sites/all/modules.
  80. Or use the UI and install it via admin/modules/install.
  81. Note:
  82. Mobile Switch branch 2+ requires Libraries API 2+.
  83. 4)
  84. Copy the Mobile Switch folder to the modules folder in your installation.
  85. Usually this is sites/all/modules.
  86. Or use the UI and install it via admin/modules/install.
  87. 5)
  88. Enable the modules
  89. Important:
  90. As first step, enable ONLY the Libraries API module!
  91. As second step, enable the modules Mobile Switch and Mobile Detect Import.
  92. Enable modules under Administration -> Modules.
  93. admin/modules
  94. UPDATE FROM 1 TO 2 BRANCH
  95. 1)
  96. Visit the Mobile Switch administration and inspect the configuration
  97. parameters.
  98. Make sure that you can remember all the configuration details.
  99. 2)
  100. Disable and uninstall Mobile Switch and if used, the
  101. Mobile Switch Block module.
  102. Disable and uninstall the Browscap module when it is no longer
  103. necessary (by other modules, or for logging of user agents).
  104. 3)
  105. Follow the steps described in the INSTALL section above.
  106. Install and enable the Mobile Switch Block module if it was uninstalled
  107. in the update step 2.
  108. 4)
  109. Administer the Mobile Switch module and reconfigure all parameter
  110. to the previous settings.
  111. If again the Mobile Switch block module enabled in the update step 3,
  112. then enable the block 'Mobile switch' in the desktop and mobile theme.
  113. ADMINISTER
  114. - Administer single site
  115. This section only describes the administration when using
  116. the operating mode 'theme switch'!
  117. Other operating modes:
  118. Not all settings are available in each operating mode.
  119. To get extended informations about the operating mode 'redirect to website'
  120. please read the HELP.txt.
  121. 1)
  122. Administer themes under Appearance.
  123. admin/appearance
  124. Enable the prefered mobile theme (NOT use 'Enable and set default').
  125. If the prefered mobile theme already enabled not use 'Set default'.
  126. 2)
  127. Administer the Mobile Switch module under:
  128. Administration -> Configuration -> User interface
  129. admin/config/user-interface/mobile-switch
  130. Choose your mobile theme.
  131. If a theme used as mobile theme, their displayed informations on the
  132. Appearance administration page are altered for better visualisation.
  133. A Mobile Switch mobile theme is default not available in the maintenance mode.
  134. - Mobile theme on administration pages
  135. Configure the 'Administration usage' in the module 'Basic settings' to
  136. enable the use of the mobile theme on administration pages.
  137. - Mobile device prevention
  138. It is possible to bypass the automatic switching to the mobile theme for
  139. mobile devices.
  140. This is useful, for example, to exclude large tablets for the theme
  141. switching.
  142. To use this,
  143. administer the 'Advanced' settings under:
  144. Administration -> Configuration -> User interface -> Mobile Switch
  145. admin/config/user-interface/mobile-switch/advanced
  146. enable the 'Use preventing' option and configure the user agent strings
  147. for such devices.
  148. To test this feature, without a real mobile device, it is a good
  149. solution to use the desktop browser with a user agent switcher extension
  150. and custom defined user agents.
  151. - For the development of a web site
  152. Administer the 'Development' settings under:
  153. Administration -> Configuration -> User interface -> Mobile Switch
  154. admin/config/user-interface/mobile-switch/development
  155. a) Enable/disable the 'Developer modus'.
  156. If a desktop mobile emulator not detected from Mobile Detect it is
  157. possible to configure additional user agents.
  158. b) Enable/disable desktop browser usage of the mobile theme.
  159. 3)
  160. Administer the Mobile Detect Import module.
  161. See README.txt of the module.
  162. - Administer shared content multisite
  163. For a complete administration of both sites (the desktop and the mobile site)
  164. with all aspects of the configuration, you need two browsers (on desktop and
  165. mobile device) or a browser with a user-agent switcher on your device.
  166. You can emulate the mobile device with the 'Opera Mobile Emulator'.
  167. DEVELOPMENT
  168. Development with Mobile Switch.
  169. Possible is the usage of the
  170. @code
  171. mobile_switch_mobile_detect()
  172. @endcode
  173. function. Please read the inline code documentation of this function.
  174. Full access to the loaded Mobile Detect PHP class:
  175. @code
  176. global $msw_detect;
  177. $msw_detect->isMobile();
  178. $msw_detect->isTablet();
  179. @endcode
  180. The loaded class is also available in the operating mode 'Do not use'.
  181. MODULE DEVELOPMENT
  182. The module is only tested in a Apache web server environment.
  183. EXTERNAL RECOURCES
  184. Mobile Emulators & Simulators: The Ultimate Guide
  185. http://www.mobilexweb.com/emulators