Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Example 1 for Formatter
<?php
require_once 'class-formatter.php';
class Lister extends Formatter
{
public function get_list( $data = array() ){
$inner = new stdClass();
$values = new stdClass();
foreach( $data as $key => $value ){
$values->key = $key;
$values->item = $value;
$inner->inner .= self::sprintf( '<li>%item%</li>', $values );
}
return self::sprintf( '<ol>%inner%</ol>', $inner );
}
}
$data = array( 'Eins', 'Zwei', 'Drei' );
$list = new Lister();
echo $list->get_list( $data );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment