Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I only want to show the "Switch back to mobile view" link to mobile users only on the desktop theme.
So it should not be displayed to desktop users.
I think the best way to implement this is to add something like this to my page.tpl.php on the desktop theme:
if ( $_SESSION['mobile_subdomain']['noredirect'] ) {
print 'Switch back to mobile view';
}
Is this the right way for this?
Thank you!
Comments
Comment #1
saltednutPlease post a patch. :)
Comment #2
saltednutComment #3
saltednutOops sorry I should have read closer. This was a support request. My bad!
You are close.
You'd want the code to be:
This way you can ensure that variable is available and TRUE. The code you posted may work, but its my preference to be a little more verbose here as you are assuming the variable is available and it may not be, which could cause an exception.
Please mark this as fixed if it fixes your issue.
Comment #4
perohu CreditAttribution: perohu commentedThx