Filter items return value problem

Comments

4 comments

  • Andreas Haugstrup Pedersen

    Hi Sabine,

    That is an old example you found. The current version of podio-php is a bit easier to work with. You can see a bit of documentation around collections at: http://podio.github.io/podio-php/objects/

    But basically you can treat the collection as an array and just iterate over it:

    $item_collection = PodioItem::filter( YOUR_APP_ID )
    
    foreach ($item_collection as $item) {
      print "Item: " . $item->title;
    }
    

    The documentation I link above also shows you how to use a get method to get items by their item_id and how to add and remove items from the collection.

    0
    Comment actions Permalink
  • Sabine Visser

    Thanks Andreas, that is really helpful! Got it now.

    0
    Comment actions Permalink
  • Lars Nobel

    But thats only the value for the title, how do i get the email and category value etc?

    $items = PodioItem::filter($app_id, $attributes = array(), $options = array());
    foreach ($items as $item) {
        $item_fields = $item->fields;
        // echo $item_fields[0] . "<br>";
        // echo $item_fields[1] . "<br>";
        // echo $item_fields[2] . "<br>";
        // echo $item_fields[3] . "<br><br><br>";
     
        foreach ($item_fields as $item_field) {
            echo $item_field->values . "<br><br>";
        }

    }
    This is how far i got, but it only prints the title since its the only data not an array inside an array
    0
    Comment actions Permalink
  • Lars Nobel

    Lars


    Notice: Array to string conversion in C:\xampp\htdocs\podio-test-api\app.php on line 26
    Array


    Notice: Array to string conversion in C:\xampp\htdocs\podio-test-api\app.php on line 26
    Array

    Asger


    Notice: Array to string conversion in C:\xampp\htdocs\podio-test-api\app.php on line 26
    Array

    Array ( [0] => Array ( [file_id] => 1493494868 [link] => https://files.podio.com/1493494868 [thumbnail_link] => https://files.podio.com/1493494868 [hosted_by] => podio [name] => maxresdefault.jpg [mimetype] => image/jpeg [size] => 39632 ) )


    Notice: Array to string conversion in C:\xampp\htdocs\podio-test-api\app.php on line 26
    Array

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk