Theming a Template in a Module

// hook_menu()
function example_menu() {

$items = array();
$items['get_user_profile'] = array(
    'title' => 'User Profile',
    'page callback' => 'get_user_profile',
    'access arguments'  => array('access content'),
    'type' => MENU_CALLBACK
  );

function get_user_profile($uid, $gid){
  $data = array('uid' => $uid,
     'gid' => $gid,
  );
  return theme('user_profile_data',$data);
}

// hook_theme()
function example_theme() {
    return array(
        'user_profile_data'=> array(
        'arguments'=> array('rows'=>NULL,),
        'template' =>'user-profile-popup', //template file
        ),
    );
}

user-profile-popup.tpl.php
//Data is present in $rows array
print_r($rows);

Contact Me

Feel free to contact me.

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.