Return an array of all rows returned from a find() call.
Only exports the fields that it has already retrieved. By default, Pods does not retrieve relationship/file field (tableless) data from the database for performance reasons. Therefore, in order to return rows from tableless data, it is necessary to run a fetch() and then export_data() on the specific items.
Function Definition
public function data ()
Source File: /pods/classes/Pods.php
Since: 2.0
Returns
(array|bool) An array of all rows returned from a find() call, or false if no items returned
Examples
Example 1
<?php $params = array( 'orderby' => 't.birth_date ASC', 'where' => 't.birth_date < "1972"', 'limit' => -1 // Return all rows ); // find() will be called when you give an array to pods() $people = pods( 'people', $params ); $all_rows = $people->data(); if ( !empty( $all_rows ) ) { foreach( $all_rows as $this_person ) { ?> <h2><?php echo $this_person->name; ?></h2> <p>Favorite Color: <?php echo $this_person->favorite_color; ?></p> <br /> <?php } } else echo '<strong>No people found.</strong>';
The above example will output:
<h2>Fred Flintstone</h2> Favorite Color: Blue <br /> <h2>Phil Lewis</h2> Favorite Color: Yellow <br />