Permalinks - Standard and Mobile Sites

9 posts by 4 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: March 4, 2014   (RSS)

By Steve99 - January 8, 2014

Hello,

This permalinks question pertains to CMS website builds involving both standard and mobile versions versus a single responsive site on web host platforms that do not support the use of subdomains.

How can permalinks be set to work with both the standard desktop version and mobile version? (mirrored page names located within a "mobile" directory)

Example for LIVE end result:
domainname.com/permalink/
domainname.com/mobile/permalink/

Example One for DEVELOPMENT end result:
localhost/domainname.com/permalink/
localhost/domainname.com/mobile/permalink/

Example Two for DEVELOPMENT end result:
IPaddress/~hostingAccountName/permalink/
IPaddress/~hostingAccountName/mobile/permalink/

For added information, we do utilize the PREFIX_URL setting for dev.

Naturally we'd need to keep the same structure with the standard and mobile, and the client would be able to link items in the WYSIWYG so we'd need them to be mirrored for this scenario. We get some customers that want a standard and mobile version, and some that want responsive so we need solutions to handle both. Unfortunately sometimes we are faced with the client insisting on using their current web host that doesn't support subdomains (mobile.domainname.com versus domainname.com/mobile/.

Thanks in advance.

Regards,
Steve

By Steve99 - January 13, 2014

Hi Dave,

Okay, wasn't sure if I was missing something as we've just recently got into using the Permalinks plugin.

And yes, I was referring to the presence of a "/mobile/" prefix to indicate that a different viewer should be used. For this scenario there's a full Standard site and a full Mobile site, same page names (viewer names) for both "views" - the mobile site would be within a "/mobile/" folder (separate markup, separate style sheet, etc).

I guess basically it would be permalinks handled in a relative fashion (for this scenario).

As permalinks, Standard as domainName.com/Cool-Product/ and Mobile as domainName.com/mobile/Cool-Product/ (each page would actually be domainName.com/productDetail.php?1 and domainName.com/mobile/productDetail.php?1). I believe we're thinking along the same lines to accomplish this. The permalinks dispatcher would then know it's a request from the mobile site and put "/mobile" after "domainName.com" and before "/Cool-Product/". For SEO, I don't think it would be an issue since the mobile site would be displayed to devices detected as mobile.

For a responsive designed website this situation would never present itself since there would be no "mobile site", it's just the one site with appearance changing based on the size of the device screen. This situation would also never present itself for sites hosted on platforms supporting subdomains since the mobile site can easily be set as mobile.domainName.com or m.domainName.com as the absolute link structure will work the same as the standard site.

My goal is if a client uses a WYSIWYG editor to link to a Permalink CMS page it will work on the Standard and Mobile sites without issue.

Best Regards,
Steve

By Steve99 - January 14, 2014

Hi Dave,

It just dawned on me what you mentioned with the cookie... For non-responsive sites, this entire situation could be avoided by having a single set of files serving the "view" change based on conditional. Note to self, drink more coffee...

Thanks, Dave.

Best,
Steve

By ross - January 20, 2014

Hi Steve

Just want to confirm you have this all sorted out. If there is anything else we can help with, let me know :).

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

By Steve99 - January 21, 2014

Hi Ross,

Yep, I'm all set :) Thanks!

Steve

By Jesus - March 4, 2014

Hi Steve & Ross,

Will you please clarify a little bit what did you worked out with the cookies (and how you did it) for this?

As I'm thinking on a project where I might need something like this.

Thanks in advance,

Jesus

By Steve99 - March 4, 2014

Hi Jesus,

I ended up using a session variable that was set by the result of PHP Mobile Detect script. Each file (page) would then serve the Standard or Mobile views based on the "site version".

In my case I used a session var labeled "SITEVERSION" and had the "view" toggled based on if it was set as "mobile" or "standard".

The PHP script I use can be found here:
https://github.com/serbanghita/Mobile-Detect
or
http://mobiledetect.net/

Setting the session var portion of the code:

    if ($detect->isMobile() && !$detect->isTablet()) { 
      $_SESSION['SITEVERSION'] = 'mobile'; // set site version
    } else {
      $_SESSION['SITEVERSION'] = 'standard'; // set site version
    }

I wrapped my Standard and Mobile site code (same file/page) in a conditional having the appropriate version served.

Hope that helps. Thanks!

Steve

By Jesus - March 4, 2014

Hi Steve,

This looks really neat and interesting, will take a closer look during the weekend or probably sometime during nights this week.

Thanks a lot for the info!

Jesus