本文整理匯總了PHP中Song::top方法的典型用法代碼示例。如果您正苦於以下問題:PHP Song::top方法的具體用法?PHP Song::top怎麽用?PHP Song::top使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Song
的用法示例。
在下文中一共展示了Song::top方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: count
<?php
$top_song = Song::top();
$top_song = count($top_song) != 0 ? $top_song[0] : null;
?>
<div class="belize-hole">
<div>
<?php
if (is_null($top_song)) {
?>
<p class="padded">
<span class="glyphicon glyphicon-music"></span> No Top Song Available
</p>
<?php
} else {
?>
<p class="padded">
<span class="glyphicon glyphicon-music"></span> Top song
<span class="pull-right text-right">
<?php
print (double) $top_song->getAverage();
?>
/ 10<br>
<small><?php
print (int) $top_song->countRaters();
?>
rater<?php
if ((int) $top_song->countRaters() > 1) {
print 's';
}
示例2:
<?php
require_once "config/config.inc";
$top_songs = Song::top(100);
$top_albums = Album::top(100);
$top_artists = Artist::top(100);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>
<?php
print TITLE;
?>
</title>
<?php
require_once "sections/links.php";
?>
</head>
<body>
<?php
require_once "sections/menu.php";
?>
<section class="container">
<div class="row">
<div class="col-md-4">
<div class="belize-hole">
<p class="padded">
<h3 class="padded text-center"><span class="glyphicon glyphicon-music"></span> Top Songs</h3>