Skip to main content
Topic: Responsive design shiz. (Read 16519 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: Responsive design shiz.

Reply #15

Just to note, an example.

Code: [Select]
echo '
<link rel="stylesheet" media="only screen and (max-width: 900px), only screen and (min--moz-device-pixel-ratio: 1.5) and (max-width: 1140px), only screen and (-o-min-device-pixel-ratio: 1.5/1) and (max-width: 1140px), only screen and (-webkit-min-device-pixel-ratio: 1.5) and (max-width: 1140px), only screen and (min-device-pixel-ratio: 1.5) and (max-width: 1140px)" type="text/css" href="', $settings['theme_url'], '/style_Mobile.css?116" />
<link rel="stylesheet" media="only screen and (min-width: 901px), only screen and (min--moz-device-pixel-ratio: 1.5) and (min-width: 1141px), only screen and (-o-min-device-pixel-ratio: 1.5/1) and (min-width: 1141px), only screen and (-webkit-min-device-pixel-ratio: 1.5) and (min-width: 1141px), only screen and (min-device-pixel-ratio: 1.5) and (min-width: 1141px)" type="text/css" href="', $settings['theme_url'], '/style_Standard.css?116" />';

// If, instead of these echo '<link rel...', the template is written (lets say, this is just an example idea) as:

loadCSSFile('style_Mobile.css', array(), $context['is_mobile']);
loadCSSFile('style_Standard.css', array(), $context['is_standard']);

// all the rest here

The function could insert the media links. It already sets the bits for the browser cache to 'compose' a link to a css/js file iirc.
I assume we know what to insert and when (and it would be clearly documented for themes). A custom theme wouldn't 'need' to use the function (it can use their own direct links), but it can also make use of it, knowing it offers a couple of defaults like this 'mobile' vs 'standard'.
Once those are set, in the rest the theme can use the wanted @media ... etc.
The best moment for testing your PR is right after you merge it. Can't miss with that one.

Re: Responsive design shiz.

Reply #16

Yes but on what basis does it make that decision?
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Responsive design shiz.

Reply #17

Browser detection code.
The best moment for testing your PR is right after you merge it. Can't miss with that one.

Re: Responsive design shiz.

Reply #18

Bad basis.
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Responsive design shiz.

Reply #19

I'd think for the decision on which css to send  that a browser detection would be adequate, I know its not a capabilities check, etc. but a basic your mobile or your not, and the mobile is limited to devices we are likely to care about (e.g. support with a mobile theme) anyway. 

Re: Responsive design shiz.

Reply #20

If possible I'd rather check by screen resolution, because that is what determines the layout required. It's also probably more reliable, faster, lighter on processing, and more future-proof.
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Responsive design shiz.

Reply #21

It's possible through client-side code, javascript, to match screen attributes, and ask for a much more specific stylesheet. I don't know if it's worth it. It has downsides of its own.
The best moment for testing your PR is right after you merge it. Can't miss with that one.

Re: Responsive design shiz.

Reply #22

I was more thinking something like:
Code: [Select]
loadCSSFile('style_Mobile.css', array('media' => 'only screen and (max-width: 900px), only screen and (min--moz-device-pixel-ratio: 1.5) and (max-width: 1140px), only screen and (-o-min-device-pixel-ratio: 1.5/1) and (max-width: 1140px), only screen and (-webkit-min-device-pixel-ratio: 1.5) and (max-width: 1140px), only screen and (min-device-pixel-ratio: 1.5) and (max-width: 1140px)'));
loadCSSFile('style_Standard.css', array('media' => 'only screen and (min-width: 901px), only screen and (min--moz-device-pixel-ratio: 1.5) and (min-width: 1141px), only screen and (-o-min-device-pixel-ratio: 1.5/1) and (min-width: 1141px), only screen and (-webkit-min-device-pixel-ratio: 1.5) and (min-width: 1141px), only screen and (min-device-pixel-ratio: 1.5) and (min-width: 1141px)'));

Problem is with a media minimization would need to work on two files anyway, it cannot merge the two otherwise it would be useless...
Bugs creator.
Features destroyer.
Template killer.

Re: Responsive design shiz.

Reply #23

Something like the above is what I was thinking would be good. We should be pretty safe on screen res and pixel ratio. Pitch ratio is unlikely increase over the current Retina displays and that, combined with practical physical size constraints, creates a defined range of sizes that any phones are likely to fit into.

Really we have to detect screen size and pixel ratio if we are going to provide a basis for building decent mobile gui's, because everything that contrains mobile gui's (in terms of presentation) is a result of the screen size.
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Responsive design shiz.

Reply #24

Current opinion about the site I run:

Quotewhat I'll do is have selection of mobile mode up top nice and handy

and once that's selected it will set it in proifle settings/reload page/add mobile stylesheet/trigger php conditionals to change content in templates
added stylesheet will be very small
no extra images to download

acceptable compromise for now
if they want lower bandwidth usage and fewer http requests
they can stay out of the photo and video threads 
which they wont anyway 
Last Edit: June 11, 2013, 08:13:50 am by TestMonkey
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Responsive design shiz.

Reply #25

Norv found this gem: https://twitter.com/cennydd/status/61004881011539968

Which is another point. Some people detest "mobile sites', even for forums. I've seen this sort of comment more than once.
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Responsive design shiz.

Reply #26

Quote from: Antechinus – Norv found this gem: https://twitter.com/cennydd/status/61004881011539968

Which is another point. Some people detest "mobile sites', even for forums. I've seen this sort of comment more than once.

Very true but some sites just don't work on a mobile, SMF isn't very good. Tablet is usable though.

Re: Responsive design shiz.

Reply #27

A couple more from the interwebz...

>> If only browsers hadn't forgotten the old school lowsrc attribute for images..."
(source)

>> Do we need to redesign the web every time Apple releases a new device?
(comment somewhere on iPhone and Retina displays)
The best moment for testing your PR is right after you merge it. Can't miss with that one.

Re: Responsive design shiz.

Reply #28

Quote from: TestMonkey – >> Do we need to redesign the web every time Apple releases a new device?
(comment somewhere on iPhone and Retina displays)
QFTW!

And BTW: how many people are actually using a phone to type a post in a forum?
Bugs creator.
Features destroyer.
Template killer.

Re: Responsive design shiz.

Reply #29

Quote from: Trekkie101 – Very true but some sites just don't work on a mobile, SMF isn't very good. Tablet is usable though.
Yup. SMF 2.0.x default is crap. We will definitely do something better than that.

Quote from: emanuele – QFTW!

And BTW: how many people are actually using a phone to type a post in a forum?
Lots. You'd be surprised.
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P