PDA

View Full Version : Opting Out of Responsive Design (choosing desktop layouts on mobile) setup question



joeinfo
07-21-2015, 06:33 PM
1) Opting Out of Responsive Design (choosing desktop layouts on mobile)

2) Script URL (on DD): http://www.dynamicdrive.com/forums/entry.php?310-Opting-Out-of-Responsive-Design-%28choosing-desktop-layouts-on-mobile%29

3) my godaddy shared hosting account houses numerous domains... and the demo works perfectly if i upload it to the root domain. however, inside that root folder are folders for each of my other domains... and when i upload the demo into any the these domain folders (that live inside the root folder), the demo does not work.

i'd greatly appreciate any suggestions to help me get this working for the multiple domains that are hosted inside this single hosting account!

joeinfo
07-21-2015, 07:37 PM
you know what... the folks at godaddy found the problem. i had something in my htaccess file that was messing things up. when htaccess was disabled, the demo worked just fine. i will leave this here in case it helps anyone else. thanks!

Beverleyh
07-21-2015, 07:51 PM
Try setting the path parameter, or the path and domain parameters on the setcookie() line http://www.w3schools.com/php/func_http_setcookie.asp

I've heard that GoDaddy sessions and paths can be quite problematic due to the way they setup their servers so it's probably worth contacting them to ask what the settings should be to internally mapped domains/subdomains.

I would guess that the path parameter should be the name of the subfolder where other domain resides, but I don't know if that's *all* that's needed or if the domain parameter should be explicitly set too.

Hopefully just this;
etcookie('layout', $_GET['layout'], time()+60*60*24*30, '/subfolder/'); // how long for cookie (60*60*24*30 = 30 days)

Let us know what it should be when you've run your tests - I don't have access to a GoDaddy account so it's always good to learn via someone who does.

Beverleyh
07-21-2015, 07:52 PM
I took a while longer typing my last reply than I realised.

Glad you got it sorted :)

joeinfo
07-21-2015, 09:22 PM
thanks for your reply, beverleyh.
what it turned out to be was... i had noticed in my analytics that i was getting a lot of visits to urls with variables strung on the back -- such as mydomain.com/index.php?id=9.

none of my pages should have query strings so my htaccess was stripping those off -- to avoid having google possibly see these urls as duplicate content.
once i deleted that RewriteCond/Rule from the htaccess your script worked wonderfully.

i've read many posts where folks think it is bad policy to offer full desktop layout on mobile devices but 1) the majority of my customers are older folks... so i believe some of them may feel most comfortable with desktop layout and 2) i hate how it is nearly impossible to finger scroll on many mobile layouts (especially the LATimes and the new layout for the NYTimes) without accidentally triggering an advertisement. they seem to strategically place their ads in the exact spots where they'll get triggered by finger scrolling. so i often click on their desktop layouts to prevent triggering multiple ads on every page.

thank you again for the wonderful script and for your gracious response to my post.

Beverleyh
07-21-2015, 09:54 PM
Ah, I see - the rewrite rule in the htaccess file would have been stripping the query string from the end of the switch, which wouldn't activate the cookie;

<?php if ($layout == 'fixed') {
echo '<p class="switch"><a href="?layout=rwd">Switch to Fluid Mobile Layout</a></p>'; // switch to default/rwd layout
} else {
echo '<p class="switch"><a href="?layout=fixed">Switch to Fixed Desktop Layout</a></p>'; // switch to optout/fixed layout
}
?>
I'll add a note to the blog page as a tip for anyone else in the same boat. Thanks for your help on this :)