How to theme output from module? I have a simple module that is extracting names from database table. I can display that names in hook_block_view like this:

function example_block_view($delta = '') {

  // $result - an array containing names
  // $names - a string containing names from $result array

  $block = array();

  switch ($delta) {
    case 'xxxxxx':

      $block['title']   = t('Example header');
      $block['content'] = $names;
      break;      

  }

  return $block;
}


This will output string with names. But I want to use theme() function for outputting names. So I am continuing by this documentation page: https://www.drupal.org/node/722174

Therefore I edited my code to:

  $block['content'] = array(
    '#theme' =&gt; 'example',
    '#header' =&gt; 'Example header',
    '#rows' =&gt; $result, 
  );


But I can't manage out by documentation what should I do next. What is the simplest example of displaying names by custom theme function in my case? Should I do something in template.php of my theme folder, or should I make an hook_theme() in my module? How could I theme the list of names stored in $result array?
You could use hook_theme to register your theme function, but it sounds like you're wanting output an item list which can be done with theme_item_list:

  $names = array('one','two','three');
  $block['content'] = theme('item_list', array(
    'items' =&gt; $names,
    'title' =&gt; t('My Names'),
  ));


This will fill in your block's content with this:

&lt;div class="item-list"&gt;
  &lt;h3&gt;My Names&lt;/h3&gt;
  &lt;ul&gt;&lt;li class="first"&gt;one&lt;/li&gt;&lt;li&gt;two&lt;/li&gt;&lt;li class="last"&gt;three&lt;/li&gt;&lt;/ul&gt;
&lt;/div&gt;