You are here:  » link to mobile page

Support Forum



link to mobile page

Submitted by wilkins on Thu, 2013-02-28 16:56 in

Hi David

I am in the process of putting the mobile site on subdomain ie m.domain.com, got everything working so its as the main site but just the cut down version. What I would like to do is create a link from the product page on the main site to take people to the mobile page if clicked and a link from the mobile product page back to the main product page site. Is this possible?

Brent

Submitted by support on Thu, 2013-02-28 19:02

Hi Brent,

Sure - the $_SERVER["HTTP_HOST"] variable can be used to offer a redirect to the other!

Within html/product.php, try something like this:

<?php
  
if (strpos($_SERVER["HTTP_HOST"],"www")!==FALSE)
  {
    print 
"<a href='http://m.domain.com".$_SERVER["REQUEST_URI"]."'>View in mobile site</a>";
  }
  else
  {
    print 
"<a href='http://www.domain.com".$_SERVER["REQUEST_URI"]."'>View in desktop site</a>";
  }
?>

...should be close!

Cheers,
David
--
PriceTapestry.com