forum.coppermine-gallery.net

Support => cpg1.5 plugins => cpg1.5.x Support => cpg1.5 plugin contributions => Topic started by: Αndré on April 26, 2012, 02:21:18 pm

Title: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: Αndré on April 26, 2012, 02:21:18 pm
This plugin will automatically detect mobile devices and will display Coppermine with a different (preferably optimized for mobile devices) theme. Additionally, if a mobile device is detected, a new button will be displayed to let the user choose to switch between the "normal" and "mobile" view.

1.) Upload and install the plugin as described in the docs (http://documentation.coppermine-gallery.net/en/plugins.htm#plugin_manager)
2.) Open the plugin's configuration screen (you can find it in the plugin's box at the plugin manager after you installed the plugin) and choose a proper theme.

For a start I created two mobile themes, mobile_light (http://forum.coppermine-gallery.net/index.php/topic,74828.0.html) and mobile_dark (http://forum.coppermine-gallery.net/index.php/topic,74829.0.html).
Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: Afonso on April 26, 2012, 08:40:58 pm
the first translation, portuguese.[/font]
Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: pixstreet on April 26, 2012, 10:12:10 pm
Polish language file
I love this plugin thanks a lot  :)
Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: Αndré on April 27, 2012, 10:17:12 am
Added Portuguese and Polish language files in SVN revision 8386. Thank you for your contributions!
Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: arabhw on April 29, 2012, 07:46:04 am
I would like to thank you a lot :)

As you gave us this product I just translate the language file to arabic (support UTF-8 Without BOM)

I couldn't attach the file.
Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: arabhw on April 29, 2012, 07:48:58 am
here is the file
Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: Αndré on April 29, 2012, 08:55:58 am
Arabic language file added in SVN revision 8387. Thank you for your contribution!
Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: flapane on May 15, 2012, 03:46:51 pm
Here we are!
Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: Αndré on May 16, 2012, 09:28:02 am
Added Italian language file in SVN revision 8429. Thank you for your contribution.
Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: timberguy on August 11, 2012, 05:30:22 pm
Is there a way for me to exclude the custom header include function in the mobile mode?  I have a very wide banner there and would like to exclude it in a mobile view.
Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: lurkalot on August 11, 2012, 05:49:18 pm
Is there a way for me to exclude the custom header include function in the mobile mode?  I have a very wide banner there and would like to exclude it in a mobile view.

Are you using one of the mobile themes as per the as per Andre's first post above?
Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: timberguy on August 11, 2012, 06:14:48 pm
Yes, from the first post.
Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: Αndré on August 11, 2012, 08:26:31 pm
Copy the function pageheader from themes/sample/theme.php to your theme's theme.php file if it doesn't exist. Then, find
Code: [Select]
$custom_header = cpg_get_custom_include($CONFIG['custom_header_path']);and replace with
Code: [Select]
    if (defined('MOBILE_VIEW')) {
        $custom_header = cpg_get_custom_include($CONFIG['custom_header_path']);
    }
Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: flapane on September 11, 2012, 11:59:44 am
I don't know how the plugin works because I'm slowling working on my version (which regards the whole website and not only the gallery, so it's not a cpg-only mod), but I'd like to give a contribution.
There still are a few glitches left on the gallery only (as shown in the screenshoot, the third column images still overflow. I guess a two column layout on mobile devices would be better, but I still didn't figure out how to use 2column-layout on mobile devices only), anyway just in case, here's the conditional css syntax I used, and it seems that it can succesfully detects both iPad/iPhones, Android devices, 320x240 devices.

Code: [Select]
@media only screen and (min-device-width : 320px) and (max-device-width : 480px), only screen and (min-device-width : 480px) and (max-device-width : 800px) and (orientation : landscape), only screen and (device-width: 768px), only screen and (-webkit-min-device-pixel-ratio : 1.5), only screen and (min-device-pixel-ratio : 1.5), only screen and (-moz-min-device-pixel-ratio: 1.5)
 {
[do stuff...]
}
Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: Αndré on September 11, 2012, 12:25:09 pm
The plugin itself won't affect the layout. Instead, you have to choose a theme which will be displayed for mobile devices. My two example themes both force a 1 column layout (i.e. they overwrite config values).
Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: ogimages on November 28, 2012, 05:32:23 pm
works great, http://ogimages.com

thanks
mobile photo sharing website up in running in minutes...

adult stuff..

Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: Artin on November 27, 2013, 07:44:43 am
Hi,

Whenever I try to install the plugins after uploading it, it says:

Critical error
There was an error while processing a database query


When I upgraded to the latest version, I ran the update.php script and everything.

Coppermine version: 1.5.24

Any ideas?

Thank you.
Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: Αndré on November 27, 2013, 09:54:26 am
Please enable debug mode in the Coppermine config and try again to install the plugin. Please post the extended error message.
Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: Artin on November 27, 2013, 09:41:31 pm
First bit part of the red box:
http://pastebin.com/64uYUs5J

Debug info:
http://pastebin.com/7T1MgxdS
Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: gmc on November 28, 2013, 02:20:02 am
The error message you are getting:
Quote
While executing query 'INSERT INTO cpg14x_config (name, value) VALUES ('theme_switch_mobile_theme', 'water_drop')' in plugins/theme_switch/codebase.php on line 141
 
mySQL error: Duplicate entry 'theme_switch_mobile_theme' for key 'PRIMARY'
is trying to insert a setting into the config file that already exists... Either already inserted during a prior failed install, or not properly uninstalled..

You can either delete the row from cpg14x_config (via a tool like phpMyAdmin) or edit plugins/theme_switch/codebase.php on line 141 and change the INSERT to INSERT IGNORE. There may be additional inserts in same area that previously ran as well? I can't download the plugin at the moment to check. INSERT IGNORE will insert the value if it can, but tells MySQL to  ignore a failure like key already exists, and continue.

Of course can't tell what your original error was, but once you get past the duplicate inserts, again post your error from debug.
(direct paste or attach preferred - as that information will remain... External links disappear and won't help others that have a similar issue in the future.)

Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: Antegy on January 29, 2014, 05:25:59 pm
Hi,

I just installed this plug-in (at www.antegy.com), but my mobile browser returns the error "The page isn't redirecting properly" ("Firefox has detected that the server is redirecting the request for this address in a way that will never complete.").  I've also tried with Chrome browser; which doesn't work either.

Any suggestions?

Thanks!,
- Mark
Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: Antegy on January 29, 2014, 05:59:37 pm
Sorry! I just realized - I had the mobile theme it was to switch to in an incorrect directory.  It actually works fine now.  I apologize, I should have noticed that right away.

Thanks just the same :)
Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: Krys on September 23, 2014, 09:42:49 pm
Hello,

Thanks a lot for this plugin! Here is a french translation file :)
Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: Αndré on October 09, 2014, 01:14:23 pm
French language file added in SVN revision 8749. Thank you for your contribution.
Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: skmdd on February 09, 2015, 04:32:47 am
My website http://10celebs.com (http://10celebs.com) works fine with the plugin. Just that I noticed that there was redirect loop for the first few times I tried to connect site from my mobile.
Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: Krys on February 09, 2015, 04:15:37 pm
Hello,

I have the same redirection loop issue.

Do you have the Cookie Consent plugin installed? It worked fine for me until I install and make the Cookie Consent active on the mobile theme as well, so I guess this is a conflict issue.
Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: Krys on February 23, 2015, 09:44:40 pm
Hello,

I have looked a little bit more to this issue, and I think I can confirm there is a conflict with Cookie Consent.

The theme_switch_page_start() function in the codebase.php file calls user_save_profile() to save user data in cookie. However, this function will not set a cookie if Cookie Consent plugin is installed and if it is your first visit from a mobile device (i.e. you doesn't already have the Cookie Consent's cookie set in the browser).

Thus, it ends up in an infinite redirection loop, as it tries to run the same code and redirect again and again.
Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: allvip on May 21, 2015, 10:57:17 pm
For mitko and netb I moved your posts to Theme 'mobile_light' for cpg1.5.x http://forum.coppermine-gallery.net/index.php/topic,74828.0.html (http://forum.coppermine-gallery.net/index.php/topic,74828.0.html) because are questions about the theme not about the plugin.
Title: Re: Theme switch (mobile mode) plugin for cpg1.5.x
Post by: Cynos on November 30, 2015, 03:28:58 am
great plug in ... works like a charm ... thank you.