1.4.3 new plugin mobileTheme

vincent3569 Member, Translator
hi

I saw the new interesting plugin mobileTheme in zenphoto 1.4.3.

how can I use this plugin ?

to be more precise: I want to filter some elements of my theme zpbootstrap:
for example : not display the slideshow link, and to optimize bandwidth, display a reduced size image.

I try this code `if (isMobile()) {do something;} else {do something else};`
but it doesn't work with Zenphoto version 1.4.3-DEV [9980]

These options are set :
Phone theme : gallery theme
Tablet theme : gallery theme
Test mode : live

I have this trace
{Tue, 01 May 2012 21:17:53 GMT} Zenphoto v1.4.3-DEV[9980]
Backtrace: AVIS : Undefined variable: isGallery dans /home/avbo7291/public_html/zenphoto_dev/themes/zpBootstrap/inc_header.php à la ligne 29
include called
from include (home.php [1])
from include (index.php [4])
from index.php [92]

Comments

  • The plugin provides a class element that you can use in your theme, but you must instantiate it first:
    `$myMobile = new Mobile();`
    then you can use
    `$myMobile->isMobile()` to test if you are running on a mobile device.

    But the primary purpose of this theme is to automatically switch to a mobile theme when the client is browsing from a mobile device. If all you want to do is use the above `isMobile()` method you might be better off loading the underlying class script: Mobile_Detect. The plugin class `mobile` is a descendent from `Mobile_Detect` with additional code for handling the theme switching.

    As to your error message, I doubt that is from the plugin (the call is from your theme's `inc_header.php` script.) I have no idea what variable isGallery would be, not something in Zenphoto 1.4.3
  • vincent3569 Member, Translator
    Hi
    I found an issue with isGallery (wich is specific to my theme).

    About Mobile_Detect :
    thanks for the good advice : you are right I only need to use Mobile_Detect class.

    one question : is it possible to include this class in core components of Zenphoto ?
    I don't need the plugin in my theme, and I need to dectect mobile to optimize bandwidth.
  • acrylian Administrator, Developer
    It is (becomes) a standard plugin, so it you can use require_once to "require" it for your theme.
Sign In or Register to comment.