I'm currently building a function that switches a the site template for Mobile browsers. I'm trying to include an override for browser's such as Safari iPhone that can go to the default site. My Solution so far is to render a form with only an action that will override the mobile phone detection. Is there anyway to tie this function to a standard link anchor instead of a form button? Once again probably something simple I'm just having trouble forming the right search query for. Below is my current code:
//Overide Mobile Theme
function MobileOveride(){
if($_SESSION['mobilePhone'] != "None"){
$fields = new FieldSet();
$actions = new FormAction('overideMobile','View Standard Site');
return new Form($this, "MobileOveride", $fields, $actions);
}
else
{
return false;
}
}
function overideMobile() {
$_SESSION['mobilePhone']="None";
Director::redirect(Director::baseURL(). $this->URLSegment);
}