Parsing Syntax Error in Tera-WURFL code

Installing and configuring Tera-WURFL on your server.

Parsing Syntax Error in Tera-WURFL code

Postby accendi » Tue Jan 24, 2012 5:59 pm

I successfully installed Tera-WURFL, but when I include the following code from your site, I get a Parsing/Syntax error message.

<?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/");
}
?>

(I haven't redirected to the mobile site address yet.) The error message is:

Parse error: syntax error, unexpected T_IF in /..../header.php on line 7

in which line 7 is:

if ($wurflObj->getDeviceCapability("is_wireless_device")) {

PHP version is 5.2.17

Any help would be greatly appreciated. Thanks.
accendi
 
Posts: 1
Joined: Tue Jan 24, 2012 5:51 pm

Re: Parsing Syntax Error in Tera-WURFL code

Postby kamermans » Tue Jan 24, 2012 10:24 pm

The error message is saying that the parsing error is in header.php. When it says "unexpected T_IF..." it means that there was an error before the "if" statement and so it is unexpected. This usually means you're missing a semicolon or a closing parenthesis or something. Sometimes when you copy a code sample from a website, the quotation marks can be malformed, so you might try checking them. Also, I see the require_once statement says ".../" instead of "../", so perhaps there are some other errors as well.
Thanks,

Steve Kamerman
Tera-WURFL Author
COO of ScientiaMobile

IMPORTANT ANNOUNCEMENT! Tera-WURFL and WURFL have joined forces! We have launched ScientiaMobile to provide commercial support for our device detection solutions.

Tera-WURFL.com | Device Explorer
kamermans
Site Admin
 
Posts: 323
Joined: Wed Mar 10, 2010 12:06 pm
Location: Fort Worth, TX


Return to Installation / Configuration

Who is online

Users browsing this forum: No registered users and 1 guest

cron