SHARE
TWEET

Untitled

a guest Feb 19th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public function scopes()
  2. {
  3.     return array(
  4.         'written_time' => array(
  5.             'select' => new CDbExpression('DATE_FORMAT( written, '%H:%i') AS written_time')
  6.         ),
  7.         'written_date' => array(
  8.             'select' => new CDbExpression('DATE_FORMAT( written, '%d.%m.%Y') AS written_date')
  9.         ),
  10.         'teaser' => array(
  11.             'select' => new CDbExpression('IF(LENGTH(content) > 250, LEFT(content, 300), content) AS teaser')
  12.         ),
  13.     );
  14. }
  15.    
  16. $criteria=new CDbCriteria(array(
  17.         'order' => 'written DESC',
  18.         'scopes' => array(
  19.             'teaser',
  20.             'written_time',
  21.             'written_date',
  22.         ),
  23.         'select' => array(
  24.             'title',
  25.         ),
  26.     ));
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top