Recently I was working on mobile project in which we were working on service code in php, To find the pair in certain number in list. Example: $total = 4; $pair_total = $total * ($total - 1) * 0.5; // 6 So here we are able to find the pair combination using this formula.And pls comment if there any tricks similar to this.
Provides shpping cart functionality for models. Cart is a container object that holds items collection and have handy methods to work with it. It uses user session as a cart data storage. Installing and configuring 1 way: Registration in the config file Add to protected/config/main.php : [php] 'import'=>array( 'ext.yiiext.components.shoppingCart.*' ), 'components' => array( 'shoppingCart' => array( 'class' => 'ext.yiiext.components.shoppingCart.EShoppingCart', ), ) 2 way: Registration by necessity [php] $cart = Yii::createComponent(array( 'class' => 'ext.yiiext.components.shoppingCart.EShoppingCart' )); //Important! $cart->init(); $book = Book::model()->findByPk(1); $cart->put($book); Preparing a model Models that you are planning to put into the cart should implement IECartPosition interface: [php] class Book extends CActiveRecord implements IECartPosit...
Comments
Post a Comment