Community @ The Turning Gate

Support community for TTG plugins and products.

NOTICE

The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.

This forum is now closed, and exists here as a read-only archive.

  • New user registrations are disabled.
  • Users cannot create new topics.
  • Users cannot reply to existing topics.

You are not logged in.

#1 2015-06-17 14:13:32

JimR
Member
Registered: 2012-11-30
Posts: 348
Website

custom css for mobile

I have a set of styles I use that have to be separated by the module. I have one for Autoindex, and another for the Gallery. I check for the G_STYLE variable in phplugins.php.

I've been working on getting my CRG style done, and it's nearly complete. I just notice it's not working on mobile.

The G_STYLE is set to "CE4-Mobile" not "CE4-CRG"


How do I detect I'm on running the CRG module while on a mobile device?


BTW - the G_STYLE variable is not defined for CRG in the documentation. I had to dig into the code to find it.


--Jim

Offline

#2 2015-06-17 14:28:56

rod barbee
Moderator
From: Port Ludlow, WA USA
Registered: 2012-09-24
Posts: 17,830
Website

Re: custom css for mobile

Have you tried using media queries?


Rod 
Just a user with way too much time on his hands.
www.rodbarbee.com
ttg-tips.com, Backlight 2/3 test site

Offline

#3 2015-06-17 14:34:32

JimR
Member
Registered: 2012-11-30
Posts: 348
Website

Re: custom css for mobile

Media queries tell me the screen size but cannot tell which module created the page I'm current on, right?

The basic style I'm overriding has a common name throughout CE4. I had to create custom css for each module to avoid the conflicts.

The problem is both Gallery and CRG are setting G_STYLE to the same variable name. This same line appears in the mobile.php files for both Gallery and CRG:

define( 'TTG_COMP', 'TTG CE4-Mobile 4.0' );

I would expect something like a second variable to know it's the mobile version, or a unique name such as CE4-Gallery-Mobile and then CE4-CRG-Mobile.

Last edited by JimR (2015-06-17 14:44:00)


--Jim

Offline

#4 2015-06-17 15:26:41

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,795
Website

Re: custom css for mobile

Thanks for the heads up; I've updated the PHPlugins documentation to include CRG.

For targeting the CRG mobile gallery specifically, will G_TEMPLATE suffice?
http://ce4.theturninggate.net/docs/doku … album_sets


Matt

The Turning Gate, http://theturninggate.net

Offline

#5 2015-06-18 00:46:34

JimR
Member
Registered: 2012-11-30
Posts: 348
Website

Re: custom css for mobile

will G_TEMPLATE suffice

Oh, sweet. That sounds perfect!


--Jim

Offline

#6 2015-06-18 15:22:59

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,795
Website

Re: custom css for mobile

Glad to hear it. big_smile


Matt

The Turning Gate, http://theturninggate.net

Offline

#7 2015-06-18 15:27:08

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,795
Website

Re: custom css for mobile

I'm not presently setup to adequately test this, but I think you could target multiple templates, as follows.

Name all CRG templates beginning with "crg-", and then use G_TEMPLATE to make a partial match:

function ttg_user_function( $style, $path ) { 
    if(G_STYLE == 'CE4-MOBILE' && preg_match('/^crg-(.*)$/', G_TEMPLATE)) {

    // FUNCTION HERE

    }
} // END

Matt

The Turning Gate, http://theturninggate.net

Offline

#8 2015-06-21 07:14:57

JimR
Member
Registered: 2012-11-30
Posts: 348
Website

Re: custom css for mobile

Nice tip - thanks. That's good one to document wink

I only have one CRG template, so the simple test is working.

I do have multiple galleries, but haven't needed custom CSS for a specific gallery. If I do, I'll use your tip.


--Jim

Offline

Board footer

Powered by FluxBB