yii-components

DropDownList yii 2.0 example

不羁岁月 提交于 2019-12-05 05:32:29
I am using yii 2.0 Framework. How i can make options from my database. I found this, but it's yii 1.1: <?php echo CHtml::dropDownList('listname', $select, array('M' => 'Male', 'F' => 'Female')); I want to pass it to form: <?php $form->dropDownList() ?> How i can fill my dropdownlist from my database table? Barry Use yii\helpers\Html it contains Html::dropDownList() . echo Html::dropDownList('listname', $select, ['M'=>'Male', 'F'=>'Female']); Check Yii Framework 2.0 API Controller public function actionSomething() { $sexes = ['M'=>'Male', 'F'=>'Female']; $this->render('yourView', ['sexes'=>

YII compress your application output using gzip

蹲街弑〆低调 提交于 2019-12-04 16:30:25
what is the benefit of below code that is two events. what its actually doing ?? require_once($yii); $app = Yii::createWebApplication($config); Yii::app()->onBeginRequest = function($event) { return ob_start("ob_gzhandler"); }; Yii::app()->onEndRequest = function($event) { return ob_end_flush(); }; $app->run(); please explain the function of this code in my application.what it does ?? and how can it help me ?? The above code buffers the content and gzips it according to browser, rather than sending it straight away. Yii::app()->onBeginRequest = function($event) { return ob_start("ob_gzhandler"

afterAjaxUpdate callbackfunction CListView shows undefined

点点圈 提交于 2019-12-04 14:26:59
i am trying to call a function which is defined in another js file by afterAjaxUpdate paramter of the file name but i got error in console that function is not defined <?php $dataProvider=new CActiveDataProvider('profiles',array('pagination'=>array('pageSize'=>3))); ?> <?php $this->widget('zii.widgets.CListView', array( 'dataProvider'=>$dataProvider, 'itemView'=>'_profilesview', 'template'=>'{sorter}<br />{pager}{items}{pager}', 'enableSorting' => true, 'sortableAttributes'=>array( 'name'=>'By firstName', 'location'=>'By city', 'age'=>'By age', 'likes'=>'By likes' ), 'afterAjaxUpdate'=>

Getting Current Controller ID in Yii

半城伤御伤魂 提交于 2019-12-03 18:03:22
问题 I want to get the current controller name that handles the current action. but the in my case I will look for the current controller in my main.php in my layout files . this is my small view of my directory structure to give you an idea where is my layout files and the file where i will put my codes in searching of my controller name /protected /themes /mylayout /layouts main.php column1.php column2.php /site index.php Is this possible? im trying the following codes but i failed to get my

When to use components and when to use extensions in Yii?

十年热恋 提交于 2019-12-03 10:55:07
问题 I'm a little bit confused about the purpose of components and extensions folders in protected/ Please clarify. 回答1: According to my little experience on Yii: Components are the classes which can help you write the business logic on the basis of your models. You definitely don't want to code all of your work in controllers, then you need the component to distribute your code and call it in controller. Extensions are like the libraries, which basically are not dependent on your models, and

When to use components and when to use extensions in Yii?

微笑、不失礼 提交于 2019-12-03 01:22:01
I'm a little bit confused about the purpose of components and extensions folders in protected/ Please clarify. According to my little experience on Yii: Components are the classes which can help you write the business logic on the basis of your models. You definitely don't want to code all of your work in controllers, then you need the component to distribute your code and call it in controller. Extensions are like the libraries, which basically are not dependent on your models, and hence can be reused anywhere in current or later projects. For example: an email extension, or a class that send

Credit card transactions in Yii [closed]

泄露秘密 提交于 2019-12-02 06:23:11
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . How can we implement credit card transactions in Yii? 回答1: Your question is not that detailed of what you have tried or you are asking about API or something. What i can say is Stripe has a PHP library to accept

Credit card transactions in Yii [closed]

天涯浪子 提交于 2019-12-02 02:03:14
How can we implement credit card transactions in Yii? Your question is not that detailed of what you have tried or you are asking about API or something. What i can say is Stripe has a PHP library to accept credit cards without needing a merchant account. If you need something quick and dirty , you can just use PayPal's "Buy" buttons and drop them on your pages. These will take people off-site to PayPal where they can pay with a PayPal account or a credit card. This is free and super easy to implement. If you want something a bit nicer where people pay on-site with their credit card, then you

Override Yii2 assetManager config in controller

时光总嘲笑我的痴心妄想 提交于 2019-12-01 22:55:55
问题 I use yii-jui to add some UI elements in the views such as datePicker. In the frontend\config\main-local.php I set the following to change the theme used by the JqueryUI: $config = [ 'components' => [ 'request' => [ // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation 'cookieValidationKey' => 'gjhgjhghjg87hjh8878878', ], 'assetManager' => [ 'bundles' => [ 'yii\jui\JuiAsset' => [ 'css' => ['themes/flick/jquery-ui.css'], ], ], ], ], ]; I tried the

Override Yii2 assetManager config in controller

懵懂的女人 提交于 2019-12-01 21:08:11
I use yii-jui to add some UI elements in the views such as datePicker. In the frontend\config\main-local.php I set the following to change the theme used by the JqueryUI: $config = [ 'components' => [ 'request' => [ // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation 'cookieValidationKey' => 'gjhgjhghjg87hjh8878878', ], 'assetManager' => [ 'bundles' => [ 'yii\jui\JuiAsset' => [ 'css' => ['themes/flick/jquery-ui.css'], ], ], ], ], ]; I tried the following to override this configuration item in the controller actions method: public function