I am using the registration plugin from here
and I am setting up some custom fields in an json_encode array:
<?php
$fields = json_encode(array(
array('name' => 'name'),
array('name' => 'city', 'description' => 'City', 'type' => 'typeahead', 'categories'=>'city')
));
?>
<iframe src="https://www.facebook.com/plugins/registration.php?
client_id=xxxxxxxxxxxxxxx&
redirect_uri=https%3A%2F%2Fdevelopers.facebook.com%2Ftools%2Fecho%2F&
fields=<?php echo urlencode($fields);?>"
scrolling="auto"
frameborder="no"
style="border:none"
allowTransparency="true"
width="100%"
height="330">
</iframe>
In the facebook example they say that you can set up something like this, and when you type it is gonna give you a hint with a 'city','country','state_province':
{'name':'live', 'description':'Best Place to Live', 'type':'typeahead', 'categories':['city','country','state_province']}
In my case I try to do it like this:
array('name' => 'city', 'description' => 'City', 'type' => 'typeahead', 'categories'=>'city')
But it doesn’t work. if i get that line out the plugin works just fine, which means I am not setting it right.
I’ve also tried this, and it doesn’t work:
array('name' => 'city', 'description' => 'City', 'type' => 'typeahead', 'categories':['city','country','state_province'])
Any ideas on what I am doing wrong?
I think you need to do this:
…instead. This:
…is Javascript syntax and is not valid in PHP – it will result in a parse error. The equivalent in PHP is