Wednesday, July 3, 2019

php - Customzing Eventbrite list, I get unexpected T_FUNCTION, but it works locally

Answer



I'm displaying an events list from my Eventbrite account and when run locally, it works. When I upload it to my live test site, it triggers:




Parse error: syntax error, unexpected T_FUNCTION in ... on line ...



My PHP is as follows and pretty much verbatim from https://github.com/ryanjarvinen/eventbrite.php/blob/master/examples/event-list-example.md



include "Eventbrite.php";
$authentication_tokens = array('app_key' => 'XXXXXXXX',
'user_key' => '123456789');
$eb_client = new Eventbrite( $authentication_tokens );


$events = $eb_client->user_list_events();

$custom_render_function = function($evnt){
$time = strtotime($evnt->start_date);
if( isset($evnt->venue) && isset( $evnt->venue->name )){
$venue_name = $evnt->venue->name;
}else{
$venue_name = 'online';
}
$event_html = "


" . strftime('%a, %B %e', $time) . "
".$evnt->title."
" . strftime('%l:%M %P', $time) . "
" . $venue_name . "
\n";
return $event_html;
}

?>





Can anyone help me see where I've gone wrong?



UPDATE:
It was the version of PHP on the server (5.3). Mine had to be updated by the hosting service but it took only 30secs and this issue was resolved.

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...