yii2-advanced-app

Force HTTPS on Yii2

若如初见. 提交于 2019-12-12 09:01:49
问题 Requirement How to forcibly redirect to https (redirect if user accessing http) on Yii2? I already tried web.config to force https, but it didn't work. scenario I am using Yii2 advanced app hosted on IIS 7.5. 回答1: Its actually very easy in Yii2 as there is a predefined method for your check. Just three steps needed: 1. Extend the application class Extend the default yii web-application class and override the handleRequest -method. Use the existing Yii2-function to check if the connection is

How to load class at every page load in advanced app

≯℡__Kan透↙ 提交于 2019-12-12 05:48:01
问题 I want to have class in which I would put all my methods that should run everytime someone loads a page, lets call it InitRoutines. In yii2 basic app I would do something like this. I would add class to compontents config file, and add it to bootstrap, simple as that. But I can not figure out how to do it in advanced app, preferable in common/config config.php $config = [ // .. 'components' => [ 'InitRoutines' => [ 'class' => 'app\commands\InitRoutines', ], ], ]; $config['bootstrap'][] =

yii2 access denied to gii

不羁岁月 提交于 2019-12-12 05:37:37
问题 I have set up yii2 using composer. i have modified front end and backend in apache to display as alieses - yii2f and yii2b . I am trying to access gii using url yii2f/index.php/gii but i keep hetting following error 2015-03-25 15:42:10 [172.16.0.85][-][-][warning][yii\gii\Module::checkAccess] Access to Gii is denied due to IP address restriction. The requested IP is 172.16.0.85 2015-03-25 15:42:10 [172.16.0.85][-][-][error][yii\web\HttpException:403] exception 'yii\web\ForbiddenHttpException'

Error when trying to load Dual Listbox in Yii2

南笙酒味 提交于 2019-12-12 05:14:39
问题 In the project that I want to develop, user can upload an Excel file (xls,xlsx) to system. The excel sheet has headers in the first row, and value in another row. System has a default excel template that consist the rule for headers sequence such as (Name, Age, Sex), but sometimes user use their own excel template so sometimes the header sequence become like this (Sex, Name, Age). To handle this sequence, I've a plan to make a mapping process to handle the headers sequence before save the

Yii2 drop down pagination in GridView

不想你离开。 提交于 2019-12-12 04:36:16
问题 I want to make dorpdown pagination in yii2 gridview. I tried this in my GridView, but don't clear what should the next step I do to do. <label> <?= $form->field($model, 'pagesize') ->dropDownList( ["1"=>"1","10"=>"10","25"=>"25","50"=>"50","100"=>"100"], )->label(''); ?>  records per page </label> 回答1: <?= GridView::widget([ 'dataProvider' => $dataProvider, 'filterModel' => $model, 'filterSelector' => '#' . Html::getInputId($model, 'pagesize'), 'columns' => [ 'id', 'symbol', 'code', 'name', .

Unable to implement Yii2 wizard

孤人 提交于 2019-12-12 04:30:45
问题 I am trying to implement wizard in my yii2 project with no luck. I have one create form which i want to make as multi-step form similar to this, I have tried this extension in yii2 it works only with 'content' => 'This is step 1' but I want to have Activefields instead. Does anyone know how to make it work?? <?php $wizard_config = [ 'id' => 'stepwizard', 'steps' => [ 1 => [ 'title' => 'Step 1', 'icon' => 'glyphicon glyphicon-cloud-download', 'content' => $form->field($model, 'door_no')-

How to remove frontend/web from url in Yii2 advanced so that it doesn't appear when I use Url::to

旧巷老猫 提交于 2019-12-12 04:24:54
问题 I have written .htaccess files to prevent frontend/web from appearing in url but when I saet links through Url::to it appears in url. This is my .htaccess in root directory: <IfModule mod_rewrite.c> Options +FollowSymlinks RewriteEngine On </IfModule> <IfModule mod_rewrite.c> # deal with admin first RewriteCond %{REQUEST_URI} ^/(admin) RewriteRule ^admin/assets/(.*)$ backend/web/assets/$1 [L] RewriteRule ^admin/css/(.*)$ backend/web/css/$1 [L] RewriteCond %{REQUEST_URI} !^/backend/web/(assets

Yii2 Gridview Displaying 4 identical Pages of Results

耗尽温柔 提交于 2019-12-12 04:21:56
问题 I am working on a web application based off of the yii2 advanced application template. I have written a database query and implemented it with findbysql() returning the correct records via a grid-view generated from the gii CRUD. However for some reason 4 pages of identical results are returned. Each page is showing identical primary keys (1-10) in order, while the element index increases linearly across all 4 pages (1-40). I have commented out the action column so i figured i did not need to

Undefined variable: yii2

假如想象 提交于 2019-12-12 04:19:05
问题 Getting error when I am trying to create dynamic form in using yii2-dynamicform. at the time of create method it is working fine but at the time of update showing the error. I have two tables one is 1.vendors & 2.vendors_more_categories Relation is 1-* between vendors & vendors_more_categories I just refereed https://github.com/wbraganca/yii2-dynamicform this link. <?php namespace app\controllers; namespace backend\controllers; use Yii; use app\models\Vendors; use app\models\VendorsSearch;

load fixture data for acceptance tests - Codeception

感情迁移 提交于 2019-12-12 04:08:43
问题 Hope Everyone is doing great. I have a problem. I need to get my fixtures loaded in db before running acceptance test in codception in my Yii2 Application. here is teh detail for it. Target : Load fixtures in database so that I can run acceptance tests on them. Problem : Despite of my a at most efforts, I am still I am unable to achieve this affect Here is the data that I got to share with you: common\modules\myCustomModule\tests\acceptance\models\DashboardCest ``` class ResumeDashboardCest {