Changes
Title
unchanged
How to create a Widget - Recent Comments widget
Category
unchanged
How-tos
Yii version
changed
1.1
Tags
changed
Widgets, comments, themingtheming,comments
Content
changed
[...]
**Step 1: - Creating a Widget Component**
**components/Comments.php**
```php
Yii::import('zii.widgets.CPortlet');[...]
```php
<ul>
<?php
$comments = $this->getComments();
foreach(
$comments as $comment)
{
echo "<li> {$comment->fieldName}</li>";[...]
```php
public function findRecentComments($limit=null)
{[...]
```php
$this->widget('Comments', array(
'maxComments'=>10,
));
```[...]