Mokoalav3.5

Creating a User Directory

Now that you know how to get data from Mokoala we'll show you how to do something more useful with it.

$paginator = new MK_Paginator();
$paginator->setPerPage(10);
$paginator->setPage( MK_Request::getQuery('page', 1) );

$user_module = MK_RecordModuleManager::getFromType('user');
$users = $user_module->getRecords($paginator);

foreach($users as $user){
	print $user->getDisplayName()."<br />";
}

print $paginator->render('members.php?page={page}');

As with the last example from the 'Getting Data' section, we use the MK_Paginator class, however, this time we are using the MK_Paginator::render() method. This method outputs HTML with links that allow us to navigate between the pages in the list we're creating.