Mobile Redirect with Tera-WURFL: Syntax error
Permalink
I have posted a request on the Tera_WURFL site, but thought I might get a quick answer here from a c5 PHP expert. I successfully installed the Tera-WURFL package. This is for a redirect, not a theme switch. I have included the following code directly from the Tera-WURFL site as the first lines in my theme's header.php file:
<?php
require_once '.../Tera-Wurfl/TeraWurfl.php';
$wurflObj = new TeraWurfl();
$wurflObj->getDeviceCapabilitiesFromAgent();
// see if this client is on a wireless device
if ($wurflObj->getDeviceCapability("is_wireless_device")) {
header("http://yourwebsite.mobi/");
}
?>
(No, I haven't changed the redirect address yet.)
I am getting this error:
Parse error: syntax error, unexpected T_IF in /home/.../public_html/themes/.../elements/header.php on line 7
Where this is line 7:
if($wurflObj->getDeviceCapabilities('is_wireless_device'))
I realize this is not really a c5 issue, but any help would be most appreciated.
<?php
require_once '.../Tera-Wurfl/TeraWurfl.php';
$wurflObj = new TeraWurfl();
$wurflObj->getDeviceCapabilitiesFromAgent();
// see if this client is on a wireless device
if ($wurflObj->getDeviceCapability("is_wireless_device")) {
header("http://yourwebsite.mobi/");
}
?>
(No, I haven't changed the redirect address yet.)
I am getting this error:
Parse error: syntax error, unexpected T_IF in /home/.../public_html/themes/.../elements/header.php on line 7
Where this is line 7:
if($wurflObj->getDeviceCapabilities('is_wireless_device'))
I realize this is not really a c5 issue, but any help would be most appreciated.
Nevermind. I used code fromhttp://detectmobilebrowsers.com/... and it seems to be detecting and switching fine.
Could you please elaborate on how you installed - detectmobilebrowsers? I have used it on a number of HTML sites, but have not installed on a Concrete5 site.
Did you add the folder - Includes? Where ? As in 'includes/mobile_device_detect.php');
Thanks
Did you add the folder - Includes? Where ? As in 'includes/mobile_device_detect.php');
Thanks
Warning: require_once(.../Tera-Wurfl/TeraWurfl.php) [function.require-once]: failed to open stream: No such file or directory in /home/.../public_html/themes/.../elements/header.php on line 2
Fatal error: require_once() [function.require]: Failed opening required '.../Tera-Wurfl/TeraWurfl.php' (include_path='/home/.../public_html/libraries/3rdparty:/home/.../public_html/concrete/config/../libraries/3rdparty:.:/usr/lib/php:/usr/local/lib/php') in /home/...j/public_html/themes/.../elements/header.php on line 2
The Tera-Wurfl folder is in the site root.
Anybody?