Post

2 followers Follow
0
Avatar

Access podio return value

I am accessing a contact app using the following code

$items = PodioItem::filter(14900000, array(
'filters' => array('name' => 'name-of-user')
));

$id='name';
echo ($items->field($id));

However I cannot display the field values. Can you please tell me how to access the fields. Thank you

Indika Ratnayake

Please sign in to leave a comment.

4 comments

0
Avatar

Thanks for the reply Brian. I tried that but it didn't display anything. I know the data is there because when I try var_dump($items); it displays everything. I am having trouble extracting individual elements. 

Indika Ratnayake 0 votes
0
Avatar

Hi Indika,

Depending on the field type you have to access the content slightly differently (see http://podio.github.io/podio-php/fields/ for examples). But this should be enough to get you started

$items = PodioItem::filter($app_id);
$item = $items[0];
foreach ($item->fields as $i => $value) {
print $value->field_id . " (" . $value->type . "): " . $value->values . "\n";
}

Cheers,

Brian

Brian Stengaard 0 votes