By using jspdf library which generates PDF files using java script.You can download library from http://jspdf.com/ after downloading the library create a html or php file in example folder and paste below code.It already as many examples. but sharing this code ,because we can,t add edit or alter code.but we can add function to work according to our condition.because we can replace or change other option in saveondisk button.one more think we can add php variable in it to create pdf file with php content. <!doctype> <html> <head> <title>jsPDF</title> <link rel="stylesheet" type="text/css" href="css/main.css"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script type="text/javascript" src="../libs/downloadify/js/swfobject.js"></script> <script type="text/javascript" src="
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
Recently i was working on YII2 project in which i came across arrayhelper::map() and was thinking alternate in php. so i used array_map() also tested the performance of both in yii2 by start time and end time for both ,surprising was that execution time remain same.please let me know if there is any alternate that will execute faster then arrayhelper::map(). Adding the code in yii2: function find_field($value){ $value['id'] = $value['name']; return $value['id']; } $array = ['1'=>['id'=>1,'name' =>"pramodh",'address' =>'45 vk street','loc'=>'cbe'],'2'=>['id'=>2,'name' =>"pramodh kumar",'address' =>'45343 vk street','loc'=>'pune']]; $a = array_map(array($this,'find_field'),$array); print_r($a); yii2 code: $list = ArrayHelper::map($array, ' id ' ,
Comments
Post a Comment