Arabic | English | Spanish | Indonesian | Japanese | Polish | Portuguese | Russian | Ukrainian | Simplified Chinese
最近のコメントポートレットの作成
このセクションでは、最近投稿されたコメントのリストを表示する、最後のポートレットを作成します。
RecentComments クラスの作成
/wwwroot/blog/protected/components/RecentComments.php ファイルに RecentComments クラスを作成します。このファイルは以下の内容です。
上記において呼び出している findRecentComments メソッドは Comment クラスで以下のように定義されます。
recentComments ビューの作成
recentComments ビューを /wwwroot/blog/protected/components/views/recentComments.php ファイルとして保存します。
これは単純に RecentComments::getRecentComments() メソッドで返されるコメントひとつひとつを表示します。
RecentComments ポートレットの使用
レイアウトファイル /wwwroot/blog/protected/views/layouts/column2.php を修正し、このポートレットを組み込みます。
$Id$