Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Multiple default skins?
« Reply #15, on April 25th, 2012, 06:32 PM »
Liking your own post, it's something the code never cares about, but since there's no configuration for it at present, that's the sort of thing that would typically be configurable ;)

You're right about session variables, and IIRC they expire after 20 minutes in SMF/Wedge by default. Though I should note I have made distinct noises about removing sessions for guests across the board (because I don't think you really need much in the way of sessions for guests for the most part, and the rest is just for snapshots of analytical information, rather than meaningful information, IMHO)

I'd rather avoid cookies for that sort of thing, laws aside, just because they have a habit of living longer than expected, and carry an overhead per request.
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

nend

  • When is a theme, no longer what it was when installed?
  • Posts: 165
Re: Multiple default skins?
« Reply #16, on April 25th, 2012, 06:45 PM »
How about letting the browser cache some php generated content on a mobile theme?

I have done this on one of my mobile templates. You have to have a set of rules, but not that hard. Here is a basic of my rules.

Locked Topic - Cache for a week
Multiple Pages where the current page is not the last one - Cache for a day
All other likely to change - Cache for two minutes

This makes it easier on slow data speeds when you need to navigate back and such and don't want to page loading reloading all the time.

I also turned on compression for most smart devices, since they usually support compression. This is something SMF had turned off by default for all mobile devices.

On my mobile theme I am using jQuery Mobile, works pretty good, don't expect you to do the same just throwing that out there.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Multiple default skins?
« Reply #17, on April 26th, 2012, 04:41 PM »
Quote from Nightwish on April 25th, 2012, 05:40 PM
A session variable is probably the best way to store such short lived objects that have no business in the database. Cookie would probably work equally well, but with all the madness about cookies, it's probably best to avoid them when possible :)
Yeah, eh eh.
Of course it also means that if we disable sessions, a guest will have to re-run the test on every page... Which isn't cool. So maybe we could have 'emulated' sessions in the database (i.e. per IP.)
But I know Pete is gonna kill me... :P
Quote
P.S. Just noticed. I can like my own posts. Intentional behavior?
I don't think it was intentional... But I don't think it's harmful either; at worst, you'll pass off as a narcissist :P

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Multiple default skins?
« Reply #18, on April 26th, 2012, 07:44 PM »
If you want to remember a user preference for a guest, a cookie might be better in this case, because it's not something that needs to be stored, and still falls into the definition of 'remembering a user's preference', though it's complicated and depends on how you define 'persistent' for things like that.

SMF does other things like that with cookies, like remembering certain preferences for upshrinks and so on, I see no reason why we couldn't do the same for guest themes, which will still be more efficient than creating a session in *any* form, regardless of how it's created. (Oh, and no, IP session is still a bad idea, and I'd rather keep the current setup than go down that road the more I think about it)

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Multiple default skins?
« Reply #19, on April 27th, 2012, 05:28 PM »
I thought you didn't want to have non-critical cookies because of the ICO law...

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Multiple default skins?
« Reply #20, on April 27th, 2012, 05:30 PM »
I don't. However, there is an entirely separate, justified use case available for 'remembering user preferences', and the example given by markham of how it can be done is really quite neat.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Multiple default skins?
« Reply #21, on April 27th, 2012, 05:33 PM »
Must have missed that.
And if it's 'possible' to store is_mobile in a cookie, then yeah, I suppose we can do (isset($_SESSION['is_mobile']) ? $_SESSION['is_mobile'] : (isset($_COOKIE['is_mobile']) ? ...) or something like that...
The cookie would have to be short lived, though. Because what if you switch to desktop mode immediately...

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Multiple default skins?
« Reply #22, on April 27th, 2012, 05:34 PM »
That's exactly it - if the user wants to indicate that they're using a mobile site, it can be handled as a preference, and done infinitely better than the old ?wap / ?wap2 / ?imode

I seem to recall that was in no small part how Dragooon's theme worked.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Multiple default skins?
« Reply #23, on April 27th, 2012, 05:40 PM »
Technically, I dunno if you looked into it, but this is how Wedge does it:

- Checks for the session var, if not, sets it <- determines whether the current device is a mobile one.
- If mobile, uses id_theme_mobile and skin_mobile from the DB. Otherwise, uses id_theme and skin.
- User is now free to change skin_mobile etc. while browsing (Profile > Change skin)
- So, basically -- you can browse in a desktop skin while on a mobile device, then switch to your PC and browse in a mobile skin, because it's not the same session ID and thus it automatically recognizes you want to use id_theme this time, which can also be set to use a mobile skin...

I could commit all of this right now, but I have yet to write the UI for selecting the default mobile skin. (Right now it's skins/Wireless, which is going to ship with Wedge anyway, so it's not much of an issue but one might want to use another default...)
Unless you want to do it, ah ah. I just don't have the time this weekend to do anything too big in Wedge...

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Multiple default skins?
« Reply #24, on April 27th, 2012, 05:44 PM »
I won't be looking at it this weekend, I'm using what time I have to get other stuff done, seems like I'm always chasing the clock :/ It's also code I'm not that familiar with.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Multiple default skins?
« Reply #25, on April 27th, 2012, 05:47 PM »
Chasing the clock... And my posts :lol: I can barely keep up... And I haven't even had time to find the place where we discussed the action bar... Oh let's do it here: so what do you think, after a day of use...? Does it feel natural, or not? I'm not sure myself. But I certainly think it's something I should keep exploring. As for the checkbox, yesterday it was next to the action bar but I moved it back to the header because it took too much space, and I like having that checkbox look like a 'pin' on the side of a post.

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Multiple default skins?
« Reply #26, on April 27th, 2012, 05:55 PM »
It certainly feels a bit more natural, especially with the quick edit button there as well. Though having quite a dark line either side of it does break up the post + action bar + signature a bit much.

The problem with the checkbox where it is right now, it seems like it's just random and out of place.

nend

  • When is a theme, no longer what it was when installed?
  • Posts: 165
Re: Multiple default skins?
« Reply #27, on April 27th, 2012, 06:49 PM »
You guys are talking about the area on the right of this post right?

IMHO it feels too empty in that area, especially on long post. Maybe reorganize it and when the user scrolls have the bottom part break off and scroll with the page. Like the thought system can scroll down with you so you can have quick access to it at any time. This is just my opinion though.

Nao

  • Dadman with a boy
  • Posts: 16,082
Re: Multiple default skins?
« Reply #28, on April 27th, 2012, 08:52 PM »
Quote from Arantor on April 27th, 2012, 05:55 PM
It certainly feels a bit more natural, especially with the quick edit button there as well. Though having quite a dark line either side of it does break up the post + action bar + signature a bit much.
Yeah but try removing it, and suddenly it's hard to determine whether these icons are part of the post or not...
And removing the bottom line is also a problem.
Quote
The problem with the checkbox where it is right now, it seems like it's just random and out of place.
Maybe we should have a poll about what people think about this change... It's not much work in terms of HTML code, but it's certainly not a trivial change.

@nend> Nope, that's the sidebar... We're talking about the action buttons (Quote, Modify, More...) below the post.

As for what you're suggesting -- it would only be possible if the sidebar contents was smaller than the height of your viewport... Which is hardly going to be the case most of the time...
Heck, that's why I added that subtle gradient in the sidebar. So that you have something to stand for the sidebar when you scroll down too much... And not many websites take balance into consideration :P