Yiiѧϰ(5)----һЩʵÓü¼ÇÉ

À´Ô´£ºÎ´Öª ÔðÈα༭£ºÔðÈα༭ ·¢±íʱ¼ä:2013-12-06 08:43¡¡µã»÷:´Î
Yii¿ò¼ÜÖÐʵÓõļ¼ÇÉ: p>SQLÓï¾äÖÐÖ÷ÒªÉæ¼°µÄ²Ù×÷ÎÞ·ÇÊÇÔöɾ¸Ä²é.

p>ÎÒÃÇ¿ÉÒÔÔÚmodelsÖж¨Òåscopes·½·¨À´¶¨Òå×î»ù±¾µÄÊý¾Ý²Ù×÷·½·¨:

p>News.php modelÖÐ

p>[php]  

p>public function scopes()  

p>    {  

p>        return array(  

p>            //»ñÈ¡ÐÂÎÅͨÓ÷½·¨  

p>            'recommend'=>array(  

p>                'condition'=>" isrecommend = ".self::RECOMMEND,  

p>            ),  

p>            'getNews'=>array(  

p>                'select'=>array('id','title','coverimg'),                  

p>                'order'=>'dateline DESC',  

p>            ),  

p>        );  

p>    }  

p> 

p>¶¨ÒåºÃÁËÖ®ºó£¬Èç¹ûҪʹÓÃÀïÃæµÄ·½·¨£¬ÔòÖ»Ðèͨ¹ý:

p>[php]  

p>$recommend_news = News::model()->getNews()->recommend()->findAll(array(  

p>            'select'=>array('content'),  

p>            'condition'=>"coverimg <> '' and coverimg is not null and type = ".News::TYPE_YLZX,  

p>            'limit'=>'4',  

p>        ));   

p>µ÷ÓþͿÉÒÔÁË¡£

p>Éæ¼°µ½¸üÐÂÊý¾Ý·½Ãæ:

p>[php]  

p>//¸üеã»÷´ÎÊý  

p>        News::model()->updateCounters(array('clicks'=>1),"id = ".$id);  

p> 

p> 

p> 

    ·¢±íÆÀÂÛ
    Çë×Ô¾õ×ñÊØ»¥ÁªÍøÏà¹ØµÄÕþ²ß·¨¹æ£¬ÑϽû·¢²¼É«Çé¡¢±©Á¦¡¢·´¶¯µÄÑÔÂÛ¡£
    Óû§Ãû: ÑéÖ¤Âë:µã»÷ÎÒ¸ü»»Í¼Æ¬
    ×îÐÂÆÀÂÛ ¸ü¶à>>

    ÍƼöÈȵã

    • cocos2d-xѧϰ±Ê¼Ç(19)--label ¡¢label atlas
    • cocos2d-xѧϰ±Ê¼Ç(23)--µØͼµÄʹÓÃ3--CCTMXLayer
    • Cocos2d-xѧϰ£¨Ò»£©£ºHelloWorld
    • cocos2dxÔÚxcodeÏ¿ª·¢£¬±àÒëµ½androidÉÏ£¨2£©
    • cocos2d ÉèÖÃÆÁĻĬÈÏ·½Ïò
    • Cocos2d-x 2.0 Ö® Actions ¡°Èý°å¸«¡± Ö®Ò»
    • cocos2d-xѧϰ±Ê¼Ç(22)--µØͼµÄʹÓÃ2(TMX) --Z-Order¡¢AnchorPoi
    • cocos2d-xѧϰ±Ê¼Ç(18)--ÓÎÏ·´ò°ü£¨windowsƽ̨£©
    • cocos2d-xѧϰ±Ê¼Ç(16)--spritesheet(¾«Áé±íµ¥)

    ÐÂÎŹØ×¢ÅÅÐаñ

    ÈÈÃÅÍƼö ×îÐÂÍƼö
    ÍøÕ¾Ê×Ò³ - ÓÑÇéÁ´½Ó - ÍøÕ¾µØͼ - TAG±êÇ© - RSS¶©ÔÄ - ÄÚÈÝËÑË÷
    Copyright © 2008-2015 ¼ÆËã»ú¼¼Êõѧϰ½»Á÷Íø. °æȨËùÓÐ

    Ô¥ICP±¸11007008ºÅ-1