Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function scopes()
- {
- return array(
- 'written_time' => array(
- 'select' => new CDbExpression('DATE_FORMAT( written, '%H:%i') AS written_time')
- ),
- 'written_date' => array(
- 'select' => new CDbExpression('DATE_FORMAT( written, '%d.%m.%Y') AS written_date')
- ),
- 'teaser' => array(
- 'select' => new CDbExpression('IF(LENGTH(content) > 250, LEFT(content, 300), content) AS teaser')
- ),
- );
- }
- $criteria=new CDbCriteria(array(
- 'order' => 'written DESC',
- 'scopes' => array(
- 'teaser',
- 'written_time',
- 'written_date',
- ),
- 'select' => array(
- 'title',
- ),
- ));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement