Author |
Message |
JLA Board Member
Joined: 30 Apr 2009
Posts: 451 Location: U.S.A
|
Posted: Wed Nov 19, 2014 12:19 pm Post subject: PHPBB2 Mobile Optimized |
|
|
So we have been thinking alot about mobile optimization of our forum after some user feedback. We looked (years ago) at one of the old mobile phpbb2 mods but never did much with it after some initial experimentation.
So was curious on everyone's thoughts about the avenue to pursue. Would it be better to take one of the older mobile mods and rework it or simply just create new template files that will be served for specified mobile users?
Has anyone created some basic mobile templates (header, footer, viewtopic, viewforum, etc) that will scale and adapt to the user's display size (phone -tablet, etc) using responsive design, etc _________________ http://www.jlaforums.com |
|
Back to top |
|
|
Vendethiel Board Member
Joined: 26 Oct 2014
Posts: 251
|
Posted: Wed Nov 19, 2014 1:56 pm Post subject: Re: PHPBB2 Mobile Optimized |
|
|
Erm, maybe it'd be interesting to use a "lo-fi" phpBB2 mod and use it as mobile?
(Icy Phoenix has a separate mobile style, btw) _________________ Developer on EzArena, the ADR premod.
Developer on Icy Phoenix, the phpBB hybrid cms.
Developer on IntegraMOD, the full-featured premod.
Help me archive premods on github! (fixed for recent PHPs). |
|
Back to top |
|
|
dogs and things Board Member
Joined: 18 Nov 2008
Posts: 628 Location: Spain
|
Posted: Wed Nov 19, 2014 5:13 pm Post subject: Re: PHPBB2 Mobile Optimized |
|
|
I created a mobile template, without images and responsive.
Visitors with narrower screen resolutions see a button saying "Ir a versión móvil" in the header. The mobile template shows a button for switching back to the desktop version.
Before I used an automatic style switch using TeraWurfl, but I decided it is more user-friendly to leave it up to the individual.
I also made the desktop version slightly responsive, check my board at different resolutions to see the differences. I removed all button images on the desktop template, the buttons you see are all done with css.
It was quite a job, but worth the effort. Unfortunately I never annoted al the changes so I can´t offer any instructions. It's not only a template, there's edits in php files involved too. _________________ phpBB2 will never die, I hope! |
|
Back to top |
|
|
nostro Board Member
Joined: 16 Jul 2012
Posts: 54
|
Posted: Thu Nov 20, 2014 3:43 am Post subject: Re: PHPBB2 Mobile Optimized |
|
|
I'm not that fond of responsive designs (but I like what dogs and things have done), so I'm just going to create a new one from scratch and use browser detection. |
|
Back to top |
|
|
dogs and things Board Member
Joined: 18 Nov 2008
Posts: 628 Location: Spain
|
Posted: Thu Nov 20, 2014 4:47 am Post subject: Re: PHPBB2 Mobile Optimized |
|
|
I think it is better to use css media queries instead of browser detection. _________________ phpBB2 will never die, I hope! |
|
Back to top |
|
|
nostro Board Member
Joined: 16 Jul 2012
Posts: 54
|
Posted: Sat Nov 22, 2014 7:38 am Post subject: Re: PHPBB2 Mobile Optimized |
|
|
First browser detection, if it seems to be a mobile device then show it a mobile template, if that's not what that person wants he/she can change it (and set a cookie) and be shown a desktop template. So there will be 2 kind of templates (mobile and desktop), in each template then yes, I'll use (some) css media queries as needed.
What I don't like is trying to optimize the same template for mobile and desktop, that probably means bigger downloads, more work for that phone/tablet, and more difficult for me to create a template that looks good both for mobile and desktop. |
|
Back to top |
|
|
JLA Board Member
Joined: 30 Apr 2009
Posts: 451 Location: U.S.A
|
Posted: Mon Nov 24, 2014 7:50 pm Post subject: Re: PHPBB2 Mobile Optimized |
|
|
Ok - so spent some time and decided to have a couple different versions of the template depending on the device.
Our standard size that we've always ran is fixed 960.
We'll probably create a 640 and 320.
So far for testing, have the 640 running on the topic pages and using crude detection for iPhone devices. Works so will go ahead and create the rest of the base pages for the 640 and 320 layouts.
The question is this - looking for a good detection script (maybe using this class?? https://github.com/serbanghita/Mobile-Detect
That in sessions.php (adding a column called session_size) upon new session creation will determine if the user is a classic (session_size =0) medium mobile (session_size =1) or small mobile (session_size =2) and set a $user_data ($user_data['$site_size)) that can be queried on any page (viewtopic, viewforum, etc) to determine which template the user is served (classic, medium or small)
So if doing this via sessions.php the detection should only need to be called once per session right? Adding to this, if the user clicks on a "view desktop site" link in the footer - then the session_size for that session will change to 0 and that user will be served the classic version until either the session ends or they click on view medium mobile/small mobile links that would be in the footer.
Thoughts? _________________ http://www.jlaforums.com |
|
Back to top |
|
|
nostro Board Member
Joined: 16 Jul 2012
Posts: 54
|
Posted: Tue Nov 25, 2014 3:58 am Post subject: Re: PHPBB2 Mobile Optimized |
|
|
Looks fine. There would be no problem to call that detection script in each page load (if it was necessary), if I recall correctly it's more than fast enough.
I thought of using cookies instead. Sometimes I visit a forum (from the same IP) using the PC and the tablet, and I suppose the session remains the same, I'd prefer not be shown a tablet version in the PC just because last time I accessed that forum I used a tablet, and vice versa. |
|
Back to top |
|
|
JLA Board Member
Joined: 30 Apr 2009
Posts: 451 Location: U.S.A
|
Posted: Tue Nov 25, 2014 4:58 pm Post subject: Re: PHPBB2 Mobile Optimized |
|
|
nostro wrote: | Looks fine. There would be no problem to call that detection script in each page load (if it was necessary), if I recall correctly it's more than fast enough.
I thought of using cookies instead. Sometimes I visit a forum (from the same IP) using the PC and the tablet, and I suppose the session remains the same, I'd prefer not be shown a tablet version in the PC just because last time I accessed that forum I used a tablet, and vice versa. |
Agree about the cookies thing.
So trying the Mobile Detect php script - which lets you go as basic or advanced in the detection as you want. Right now just want to check for phones since the standard 960 is good for widely used tablet devices right now.
Probably want to move this to sessions but for now just on vt for testing
Code: | require_once '...your path to script/Mobile_Detect.php';
$detect = new Mobile_Detect;
$deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer');
if ($deviceType == 'phone')
{
$site_size = 640;
}
|
From there just use that var to determine whether to serve the standard template or mobile template for the page.
Seems to be working well from the multiple devices we tested with today. (iphone, Windows Phone, Note 3 and S4) _________________ http://www.jlaforums.com |
|
Back to top |
|
|
drathbun Board Member
Joined: 24 Jul 2008
Posts: 729 Location: Texas
|
Posted: Wed Nov 26, 2014 9:49 am Post subject: Re: PHPBB2 Mobile Optimized |
|
|
The template load appears in page_header, right? Why would you need code in viewtopic and so on? There is already a switch in place to select the regular or simple header (simple header is used for the pop-up smilies window, among other things). _________________ phpBBDoctor Blog |
|
Back to top |
|
|
JLA Board Member
Joined: 30 Apr 2009
Posts: 451 Location: U.S.A
|
Posted: Wed Nov 26, 2014 11:47 am Post subject: Re: PHPBB2 Mobile Optimized |
|
|
drathbun wrote: | The template load appears in page_header, right? Why would you need code in viewtopic and so on? There is already a switch in place to select the regular or simple header (simple header is used for the pop-up smilies window, among other things). |
As of right now we are using separate topic templates as well as page header and footer for the mobile size - but still using only 1 viewtopic.php for both. We call the code in viewtopic as to use the sitesize variable in subsequent code further down to allow changing some things (ad blocks and certain other items that are sent to the template) that are unique for each template size. _________________ http://www.jlaforums.com |
|
Back to top |
|
|
JLA Board Member
Joined: 30 Apr 2009
Posts: 451 Location: U.S.A
|
Posted: Tue Dec 02, 2014 12:38 pm Post subject: Re: PHPBB2 Mobile Optimized |
|
|
Just finished up the basic 640 mobile version of the viewforum page. Was trying to figure out a way to deal with those forums that have subforums (some quite a few). With the 960 main site - we place them in a right hand side bar on viewforum. For the 640 we used a simple jquery right slide out panel that works well enough. _________________ http://www.jlaforums.com |
|
Back to top |
|
|
JLA Board Member
Joined: 30 Apr 2009
Posts: 451 Location: U.S.A
|
Posted: Tue Dec 02, 2014 6:40 pm Post subject: Re: PHPBB2 Mobile Optimized |
|
|
Ok - so added a little bit of cookie magic that stays persistent for the users "browser" session along with links at the bottom of view forum and view topic to switch between the mobile and desktop version of those pages.
Cookie part easy enough
Code: |
check size var from http
if ($sizevar == xxyourdesktopsizexx)
{
setcookie("USEADESKTOPCOOKIENAME");
setcookie("USEAMOBILECOOKIENAME", '', time()-300);
}
else if ($sizevar == xxyoumobilesizexx)
{
setcookie("USEAMOBILECOOKIENAME");
setcookie("USEADESKTOPCOOKIENAME", '', time()-300);
}
if ($sizevar == 0)
{
if (isset($_COOKIE['USEADESKTOPCOOKIENAME']))
{
$sizevar = xxyourdesktopsizexx;
}
else if (isset($_COOKIE['USEAMOBILECOOKIENAME']))
{
$sizevar = xxyoumobilesizexx;
}
else
{
Do standard detection and cookie setting here
}
}
|
_________________ http://www.jlaforums.com |
|
Back to top |
|
|
dogs and things Board Member
Joined: 18 Nov 2008
Posts: 628 Location: Spain
|
Posted: Wed Dec 03, 2014 4:20 am Post subject: Re: PHPBB2 Mobile Optimized |
|
|
I'm sorry, but fixed widths and imposing templates by browser detection is not considered the way to go in modern website design.
You can do a lot for users on mobile devices by simply removing images and replacing them with css. Every single image used for your board's layout means a handshake and bandwidth. _________________ phpBB2 will never die, I hope! |
|
Back to top |
|
|
JLA Board Member
Joined: 30 Apr 2009
Posts: 451 Location: U.S.A
|
Posted: Wed Dec 03, 2014 10:24 am Post subject: Re: PHPBB2 Mobile Optimized |
|
|
dogs and things wrote: | I'm sorry, but fixed widths and imposing templates by browser detection is not considered the way to go in modern website design.
You can do a lot for users on mobile devices by simply removing images and replacing them with css. Every single image used for your board's layout means a handshake and bandwidth. |
I completely agree with you - but the "current" design (based off of 10+ year old phpbb2 subSilver) is far from what would be considered "current" or "modern" This is really just something to "quickly" deal with what currently exists until a roll out of a top to bottom site redesign. _________________ http://www.jlaforums.com |
|
Back to top |
|
|
|