Link to full site from a mobile theme

Permalink 2 users found helpful
Hi,

I have a site using the new "Mobile Theme" feature. How do I link to the standard theme from the mobile theme?

Jeff

JeffPaetkau
 
JeffPaetkau replied on at Permalink Best Answer Reply
JeffPaetkau
Hi,

Okay, this was frustrating. Not documented anywhere (that I could find), no forum posts (ditto), and no replies. Though I had to read the source to find an answer, the answer has been found!

Simply create a link to "/tools/disable_mobile.php" or set a cookie ('ccmDisableMobileView').

To go back to the mobile template re-visit the same link or remove the cookie.

You can also pass the 'rcID' parameter to the page and it will redirect to that page after disabling/re-enabling the mobile theme.

Note, the cookie that is set is set for 6 months so you may wish to override that behavior.

Jeff
ScottSandbakken replied on at Permalink Reply
ScottSandbakken
Yeah. I had to dig for this as well. I didn't even know about the rcID parameter. Thanks for that.
JeffPaetkau replied on at Permalink Reply
JeffPaetkau
There appears to be a bug. For some reason the cookie won't unset when revisiting /tools/disable_mobile.php.

To fix replace line 7 & 8 with:

setcookie('ccmDisableMobileView',false,strtotime('+6 months'),DIR_REL . '/');
$_COOKIE['ccmDisableMobileView'] = false;
nkennel replied on at Permalink Reply
nkennel
Thanks Jeff,

This was all very helpful to me. I also wanted to have a link in the full site back to the mobile site, but did not want this to show for non-mobile devices. So I put this in my footer:
<?php
if(isset($_COOKIE['ccmDisableMobileView'])) {   
   echo "<span><a href=\"". DIR_REL . "/tools/disable_mobile.php\" >mobile site</a></span>";
}
?>
nkennel replied on at Permalink Reply
nkennel
I edited the above post after finding out it wasn't working like I thought it was. It works now.
togafninja replied on at Permalink Reply
Hi,

I wanna disable the mobile site totally, where should I place the link?

thanks,
nkennel replied on at Permalink Reply
nkennel
If you do not want a mobile site at all, you can turn off the mobile theme in Dashboard->Themes. If you want visitors on mobile devices to have the option to leave the mobile site (until they reset cookies, or until the cookie expires), put a link in your mobile theme (perhaps in the footer) to "/tools/disable_mobile.php" as Jeff described in the answer above.

If you need more explanation, I can try! I'm not sure what your experience level is with HTML, and Concrete5.
chenh replied on at Permalink Reply
I went to Dashboard > themes, but there isn't an option for turning off the mobile theme. Do you know why? Maybe there is another step involved?

Thank you.
nkennel replied on at Permalink Reply 1 Attachment
nkennel
Hey Chenh,

There is no "off" but rather you choose for your "Mobile Theme" to be "same as website (default)." Screenshot attached. Do you see the "Mobile Theme" area below your list of installed themes?
bpalmer replied on at Permalink Reply
Even with the fix on line 7 and 8 of the disable_mobile.php, my cookie doesn't seem to be disabled and I cannot get back to the mobile view.

Any thoughts?
nkennel replied on at Permalink Reply
nkennel
Here are lines 6-9 in case it helps to make sure it's in the right context in your version of concrete5.
if(isset($_COOKIE['ccmDisableMobileView']) && $_COOKIE['ccmDisableMobileView'] == true) { 
   setcookie('ccmDisableMobileView',false,strtotime('+6 months'),DIR_REL . '/');
   $_COOKIE['ccmDisableMobileView'] = false;
} else {

Also, I see that I edited the original disable_mobile.php rather than using the override. I think that means I had trouble getting the override to work.
bpalmer replied on at Permalink Reply
Yeah that is the exact code that I added.

I am editing the disable_mobile.php located in the /concrete/tools/ folder.

Unfortunately, I still cannot get back to the mobile site from the desktop version.

Any idea what I did wrong? I am assuming I am doing something silly since it is working for you.

Thanks for your help!
nkennel replied on at Permalink Reply
nkennel
Hmmm. Sorry you're still having trouble. I know I had some trouble getting the link itself correct. Take a look at my post above with the code for my link from the full site back to mobile:

http://www.concrete5.org/community/forums/themes/link-to-full-site-...

Otherwise perhaps there is a typo somewhere, or a difference in how your version of concrete5 handles disable_mobile, but that seems like a long shot. I'm at 5.6.0.2
bpalmer replied on at Permalink Reply
Yeah it's odd. I am using your exact code- still with no luck. I'll keep playing around with it and hope for the best I guess.

I am running 5.6.1.2, but I don't think that is the issue.
bpalmer replied on at Permalink Reply
I noticed something a bit odd- if I completely remove the code which sets the cookie in the first place, the cookie still gets set!

Are the core files cached someplace? Or am I editing the wrong file? I am editing the wrong version of this file? If I add a new disable_mobile.php to the root /tools/ folder I get a blank page with "Access Denied" when the link is clicked.

EDIT: I figured it out... I was not aware that the "updater" folder was now used for core files... that seems a bit silly to me, I thought it would have copied the necessary files to the root folder. Anyway, after updating the disable_mobile.php in THAT directory, problem solved!

Thanks for the help!
AccountDisabled replied on at Permalink Reply
Warning: Shameless plug for my add-on!

Mobile Homehttp://www.concrete5.org/marketplace/addons/mobile-home/...

Redirect mobile or mobile and tablet devices to a mobile optimized area on your site. Easy links between mobile and full versions of your site (on the same domain) or even redirect to another mobile domain entirely.

No coding necessary. :D