本文整理汇总了PHP中Number::FormatUnit方法的典型用法代码示例。如果您正苦于以下问题:PHP Number::FormatUnit方法的具体用法?PHP Number::FormatUnit怎么用?PHP Number::FormatUnit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Number
的用法示例。
在下文中一共展示了Number::FormatUnit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GenerateUserList
public static function GenerateUserList($site_prefix, $response, $paginate = FALSE)
{
$users_html = array();
// IF total > 30 then we display page numbers
if ($paginate && $response->Total(TRUE) > 30) {
$users_html[] = Page::GeneratePageNumbers(ceil($response->Total() / 30));
}
while ($user = $response->Fetch(FALSE)) {
// Get the user's location
$user['location'] = ViewUtils::GetIndexValue($user, 'location');
// Generate the URL of their profile
$profile_url = "{$site_prefix}/users/{$user['user_id']}";
$users_html[] = '<li><span class="ui-li-count">' . Number::FormatUnit($user['reputation']) . "</span><a href='{$profile_url}'><img src='{$user['profile_image']}&s=16' class='site-icon ui-li-icon' />" . self::GenerateUsername($user) . "<p>{$user['location']}</p></a></li>";
}
if (count($users_html)) {
return implode('', $users_html);
} else {
return '<li><span class="unknown">[empty]</span></li>';
}
}
示例2: GenerateCommentButton
public static function GenerateCommentButton($site_prefix, $comments, $post_id)
{
// Generate the comment HTML
$comments_html = "<ul id='comment_content_{$post_id}' data-role='listview' data-inset='true'>";
foreach ($comments as $comment) {
if ($comment['owner']['user_type'] == 'does_not_exist') {
$comments_html .= '<li>' . strip_tags($comment['body']) . ' - <b>' . User::GenerateUsername($comment['owner']) . '</b></li>';
} else {
// Generate the URL for the comment
$comment_url = "{$site_prefix}/users/{$comment['owner']['user_id']}";
$comments_html .= "<li><a href='{$comment_url}'>" . strip_tags($comment['body']) . ' - <b>' . User::GenerateUsername($comment['owner']) . ' <span class="reputation">' . Number::FormatUnit($comment['owner']['reputation']) . '</span></b></a></li>';
}
}
$comments_html .= '</ul>';
$s = ($count = count($comments)) == 1 ? '' : 's';
return "<div id='comment_{$post_id}' class='comment'><div data-role='button' id='comment_button_{$post_id}' onclick='ShowComments({$post_id});'>Show {$count} comment{$s}</div>{$comments_html}</div>";
}