Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'yii2'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Single Editions
    • Modern Javascript: Develop and Design
    • The Yii Book
    • Effortless Flex 4 Development
    • Building a Web Site with Ajax: Visual QuickProject
    • Ruby: Visual QuickStart Guide
    • C++ Programming: Visual QuickStart Guide
    • C Programming: Visual QuickStart Guide
    • Adobe AIR: Visual QuickPro Guide
  • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
    • PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (1st Edition)
  • PHP for the Web: Visual QuickStart Guide
    • PHP for the Web: Visual QuickStart Guide (5th Edition)
    • PHP for the Web: Visual QuickStart Guide (4th Edition)
    • PHP for the Web: Visual QuickStart Guide (3rd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (2nd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (1st Edition)
  • Effortless E-commerce with PHP and MySQL
    • Effortless E-Commerce with PHP and MySQL (2nd Edition)
    • Effortless E-Commerce with PHP and MySQL
  • PHP Advanced: Visual QuickPro Guide
    • PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
    • PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
    • PHP Advanced: Visual QuickPro Guide
  • MySQL: Visual QuickStart Guide
    • MySQL: Visual QuickStart Guide (2nd Edition)
    • MySQL: Visual QuickStart Guide (1st Edition)
  • Other
    • Announcements
    • Newsletter, Blog, and Other Topics
    • Forum Issues
    • Social

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 8 results

  1. Hello, I'm using Fullcalendar for Yii2 (https://github.com/philippfrenzel/yii2fullcalendar-demo) and I want to save with Ajax the event when I click on a date. The datas commes from the dropdownlist. It seems that my code couldn't find the function in my controller, maybe it's the Url ? My view with JS and the link to my funstion Ajax on my controller : <?php $form = ActiveForm::begin(); ?> <div class="row"> <div class="col-md-4"> <?= $form->field($feuille_de_jour_responsable, 'ID_Categorie')->dropDownList(CategorieFdj::find()->select(['Nom', 'ID_Categorie'])->indexBy('ID_Categorie')->column(), ['id'=>'catId']); ?> </div> <div class="col-md-4"> <?= $form->field($feuille_de_jour_responsable, 'ID_Poste_FDJ')->dropDownList(PosteFdj::find()->select(['Nom_Poste_FDJ', 'ID_Poste_FDJ'])->indexBy('ID_Poste_FDJ')->column(), ['id'=>'postId']); ?> </div> <div class="col-md-4"> <?= $form->field($feuille_de_jour_responsable, 'Code_Personnel')->dropDownList(Personnel::find()->select(['Nom_Personnel', 'Code_Personnel'])->indexBy('Code_Personnel')->column(), ['id'=>'codePers']); ?> </div> </div> <?php ActiveForm::end();?> <?php $JSCode = <<<EOF function(start,end) { //alert ($("select[id=catid] option:selected").text()); var title = $("select[id=codePers] option:selected"); var codePersonnel = $("select[id=codePers] option:selected").val(); var posteId = $("select[id=postId] option:selected").val(); var categorieID = $("select[id=catId] option:selected").val(); //alert($('#catid').val()); var eventData; $.ajax({ url : '/site/Ajax', dataType: 'json', data: { codePersonnel : codePersonnel //dateCalendaire : start.format(), //posteId : posteID, //categorieID : categorieID // end: thedate1 }, success: function (data, response, event, date) { alert("success here"); /*$('#calendar').fullCalendar('renderEvent', { title: title, start: start.format() //end: thedate1 }, true);*/ eventData = { title: title, start: start.format(), end: start.format(), }; $('#calendar').fullCalendar('renderEvent', eventData, true); }, error: function () { alert("Oops! Something didn't work"); } }); } EOF; $JSEventClick = <<<EOF function(calEvent, jsEvent, view) { alert('Event: ' + calEvent.title); alert('Coordinates: ' + jsEvent.pageX + ',' + jsEvent.pageY); alert('View: ' + view.name); // change the border color just for fun //$(this).css('border-color', 'red'); } EOF; ?> <?= yii2fullcalendar\yii2fullcalendar::widget([ 'id' => 'calendar', 'clientOptions' => [ 'height' => 650, // 'language' => 'fa', //'eventLimit' => TRUE, 'selectable' => true, 'selectHelper' => true, 'droppable' => true, 'editable' => true, // 'theme'=>true, 'fixedWeekCount' => false, 'defaultDate' => date('Y-m-d'), 'eventClick' => new JsExpression($JSEventClick), 'select'=>new JsExpression($JSCode) ], ]); ?> <?= Html::encode($JSCode); ?> <?= Html::encode($JSEventClick); ?> And the function on my controller (SiteController) public function actionAjax(){ if(isset(Yii::$app->request->post())){ $codePersonnel = "Ajax Worked!"; echo $codePersonnel; }else{ $codePersonnel = "Ajax failed"; echo $codePersonnel; } // return Json return \yii\helpers\Json::encode($codePersonnel); } Thank you for help =) Sarah
  2. Hello, I want a form that create a "Feuille de jour" based on dropdownlist from other models. In fact, I have 4 tables that are linked by id : the table "Feuille de jour" have the id from the tables "poste FDJ", "categorie FDJ" and "personnel". When I create a "Feuille de jour", I want to be able to select (in a dropdown list) the name of a "poste FDJ", a "categorie FDJ" and a "personnel" and when I submit the form, it save the id of each name. I know it's possible to save multiple model in one form, I supposed that I can start on this but it doesn't work. Can someone help me? There are my create function controller (that had worked with a "simple" form) and my view : public function actionCreate() { $model = new FeuilleDeJourResponsable(); $meteo_prevision = new MeteoPrevision(); $poste_fdj = new PosteFdj(); $categorie_fdj = new CategorieFdj(); $personnel = new Personnel(); if ($model->load(Yii::$app->request->post()) && $meteo_prevision->load(Yii::$app->request->post()) && $poste_fdj->load(Yii::$app->request->post()) && $categorie_fdj->load(Yii::$app->request->post()) && $personnel->load(Yii::$app->request->post()) && FeuilleDeJourResponsable::validateMultiple([$model, $meteo_prevision, $poste_fdj, $categorie_fdj, $personnel])) { $poste_fdj->save(false); $categorie_fdj->save(false); $personnel->save(false); $model->ID_Poste_FDJ = $poste_fdj->ID_Poste_FDJ; // no need for validation rule on user_id as you set it yourself $model->ID_Categorie = $categorie_fdj->ID_Categorie; // no need for validation rule on user_id as you set it yourself $model->Code_Personnel = $personnel->Code_Personnel; // no need for validation rule on user_id as you set it yourself $model->save(false); // skip validation as model is already validated $meteo_prevision->Date_Calendaire = $model->Date_Calendaire; // no need for validation rule on user_id as you set it yourself $meteo_prevision->save(false); return $this->redirect(['feuille_de_jour_responsable/view', 'Date_Calendaire' => $model->Date_Calendaire]); } else { return $this->render('create', [ 'feuille_de_jour_responsable' => $model, 'meteo_prevision' => $meteo_prevision, 'poste_fdj' => $poste_fdj, 'categorie_fdj' => $categorie_fdj, 'personnel' => $personnel, ]); } } <?php $reqNomPoste = 'SELECT Nom_Poste_FDJ,ID_Poste_FDJ FROM poste_fdj'; $nomPoste = PosteFdj::findBySql($reqNomPoste) ->asArray() ->all(); /*$IDPoste = array(); $i = 0; foreach ($nomPoste["ID_Poste_FDJ"] as $ID) { $i++; $IDPoste = $ID; }*/ //var_dump($nomPoste); $reqNomPersonnel = 'SELECT Nom_Personnel,Code_Personnel FROM personnel'; $nomPersonnel = Personnel::findBySql($reqNomPersonnel) ->asArray() ->all(); //var_dump($nomPersonnel); $reqCategorie = 'SELECT Nom,ID_Categorie FROM categorie_fdj'; $categorie = CategorieFdj::findBySql($reqCategorie) ->asArray() ->all(); //var_dump($nomPersonnel); $form = ActiveForm::begin(); echo FormGrid::widget([ 'model'=>$feuille_de_jour_responsable, 'form'=>$form, 'autoGenerateColumns'=>true, 'rows'=>[ [ 'attributes'=>[ 'ID_Poste_FDJ'=>['type'=>Form::INPUT_DROPDOWN_LIST, 'items'=>PosteFdj::find()->select(['Nom_Poste_FDJ', 'ID_Poste_FDJ'])->indexBy('ID_Poste_FDJ')->column(), 'hint'=>'Choisir Poste'], //::findBySql('SELECT Nom_Poste_FDJ,ID_Poste_FDJ FROM poste_fdj'), 'hint'=>'Choisir Poste'] 'Code_Personnel'=>['type'=>Form::INPUT_DROPDOWN_LIST, 'items'=>Personnel::find()->select(['Nom_Personnel', 'Code_Personnel'])->indexBy('Code_Personnel')->column(),'hint'=>'Select Personnel'], 'ID_Categorie'=>['type'=>Form::INPUT_DROPDOWN_LIST, 'items'=>CategorieFdj::find()->select(['Nom', 'ID_Categorie'])->indexBy('ID_Categorie')->column(), 'hint'=>'Choisir Categorie'], ] ], [ 'attributes'=>[ //'Date_Calendaire'=>['type'=>Form::INPUT_TEXT, 'options'=>['placeholder'=>'Enter username...']], //'Date_Calendaire'=>['type'=>Form::INPUT_WIDGET, 'widgetClass'=>'\kartik\widgets\DatePicker', 'hint'=>'Enter birthday (mm/dd/yyyy)'], 'Date_Calendaire'=>['type'=>Form::INPUT_WIDGET, 'widgetClass'=>'\kartik\widgets\DatePicker', 'options' => [ 'pluginOptions' => [ 'todayHighlight' => true, 'format' => 'yyyy-mm-dd', 'multidate' => true, 'multidateSeparator' => ' ; ', ], ], 'hint'=>'Select Date', ], ] ], [ 'attributes'=>[ 'actions'=>[ // embed raw HTML content 'type'=>Form::INPUT_RAW, 'value'=> '<div>' . Html::resetButton('Reset', ['class'=>'btn btn-default']) . ' ' . Html::submitButton('Submit', ['class'=>'btn btn-primary']) . '</div>' ] ], ], ] ]); ?> <?php ActiveForm::end();?> Thank you ! =)
  3. Hello, I'm using yii2 since one month and I'm blocked. I need to create multiple instances of a table "Feuille_de_jour_responsable" based on dropdown list that search data on 3 other tables (the table feuille_de_jour_responsable have the ID of other tables as secondary key). The number of intances that must be saved depends on the number of datepicker selected (I use de kartik's datepicker). I have an error and I don't understand... "Either the 'formName' has to be set or a valid 'model' property must be set extending from '\yii\base\Model'." I try soooo many things ! But nothing work. There is my actionCreate functun on my controller code : public function actionCreate() { $count = count(Yii::$app->request->post('FeuilleDeJourResponsable', [])); $array_feuille_de_jour_responsable = [new FeuilleDeJourResponsable()]; for($i = 1; $i < $count; $i++) { $array_feuille_de_jour_responsable[] = new FeuilleDeJourResponsable(); } if (FeuilleDeJourResponsable::loadMultiple($array_feuille_de_jour_responsable,Yii::$app->request->post()) ) { foreach ($array_feuille_de_jour_responsable as $feuille) { $feuille->save(false); } return $this->redirect('index'); } else { return $this->render('create', [ 'feuille_de_jour_responsable' => $array_feuille_de_jour_responsable, ]); } } And my create view : <?php use yii\helpers\Html; use yii\helpers\ArrayHelper; use app\models\FeuilleDeJourResponsable; use app\models\PosteFdj; use app\models\Personnel; use app\models\CategorieFdj; use app\models\MeteoPrevision; use kartik\widgets\ActiveForm; use kartik\builder\Form; use kartik\builder\FormGrid; use kartik\builder\TabularForm; use kartik\widgets\DatePicker; $this->title = 'Création Feuille De Jour Responsable'; $this->params['breadcrumbs'][] = ['label' => 'Feuille De Jour Responsables', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; setlocale (LC_TIME, 'fr_FR.utf8','fra'); $dateDemain = ucfirst(strftime("%Y-%m-%d" , strtotime("+1 day"))); ?> <div class="feuille-de-jour-responsable-create"> <?php $reqNomPoste = 'SELECT Nom_Poste_FDJ,ID_Poste_FDJ FROM poste_fdj'; $nomPoste = PosteFdj::findBySql($reqNomPoste) ->asArray() ->all(); //var_dump($nomPoste); $reqNomPersonnel = 'SELECT Nom_Personnel,Code_Personnel FROM personnel'; $nomPersonnel = Personnel::findBySql($reqNomPersonnel) ->asArray() ->all(); //var_dump($nomPersonnel); $reqCategorie = 'SELECT Nom,ID_Categorie FROM categorie_fdj'; $categorie = CategorieFdj::findBySql($reqCategorie) ->asArray() ->all(); //var_dump($nomPersonnel); $form = ActiveForm::begin(); echo FormGrid::widget([ 'model'=>$feuille_de_jour_responsable, 'form'=>$form, 'autoGenerateColumns'=>true, 'rows'=>[ [ 'attributes'=>[ 'ID_Poste_FDJ'=>['type'=>Form::INPUT_DROPDOWN_LIST, 'items'=>$nomPoste, 'hint'=>'Choisir poste'], 'Code_Personnel'=>['type'=>Form::INPUT_DROPDOWN_LIST, 'items'=>$nomPersonnel, 'hint'=>'Choisir Responsable'], 'ID_Categorie'=>['type'=>Form::INPUT_DROPDOWN_LIST, 'items'=>$categorie, 'hint'=>'Choisir categorie'], ] ], [ 'attributes'=>[ 'Date_Calendaire'=>['type'=>Form::INPUT_WIDGET, 'widgetClass'=>'\kartik\widgets\DatePicker', 'options' => [ 'pluginOptions' => [ 'todayHighlight' => true, 'format' => 'yyyy-mm-dd', 'multidate' => true, 'multidateSeparator' => ' ; ', ], ], 'hint'=>'Select Date', ], ] ], [ 'attributes'=>[ 'actions'=>[ 'type'=>Form::INPUT_RAW, 'value'=> '<div>' . Html::resetButton('Reset', ['class'=>'btn btn-default']) . ' ' . Html::submitButton('Create', ['class' => 'btn btn-primary']) . '</div>' ], ], ], ] ]); ?> <?php ActiveForm::end();?> </div> Anyone can help me ? Thank you =)
  4. I want to be able to click on a link from the registration gridview, and filter the results of the players gridview so only the players I selected show up. Right now, it's not filtering. I get all the players. I have the following tables: - registrations - players From the registrations/index gridview I have a link so I can edit players: <?= DynaGrid::widget([ 'columns' => [ ['attribute'=>'playersEditLink', 'format'=>'raw'], [ 'label'=>'Player(s)', 'format' => 'raw', 'value' => function ($dataProvider) { $str = ''; foreach($dataProvider->players as $name) { $str .= ' '; $str .= $name->first.' '; $str .= $name->last.'<br />'; } return nl2br($str); }, 'filter' => function ($dataProvider) { $str = ''; foreach($dataProvider->players as $name) { $str .= ' '; $str .= $name->first.' '; $str .= $name->last.'<br />'; } return nl2br($str); }, ], //'transactionID', // divisionLevel dropdown editable column [ 'class' => 'kartik\grid\EditableColumn', 'header' => 'Division Level', 'attribute' => 'divisionLevelID', 'value' => 'divisionLevelName', 'pageSummary' => true, 'editableOptions'=> function ($model, $key, $index, $widget) { $divisionlevels = ArrayHelper::map(DivisionLevelAssignment::find()->where(['active'=>1])->orderBy('divisionlevelID')->asArray()->all(),'divisionlevelID','exportName'); return [ 'header' => 'Division Level', 'size' => 'sm', 'inputType' => 'dropDownList', 'displayValueConfig' => $divisionlevels, 'data' => $divisionlevels ]; } ], // field dropdown editable column [ 'class' => 'kartik\grid\EditableColumn', 'attribute' => 'field', 'value' => 'fieldName', 'pageSummary' => true, 'editableOptions'=> function ($model, $key, $index, $widget) { $fields = ArrayHelper::map(Fields::find()->all(), 'id','name'); return [ 'header' => 'Field', 'size' => 'sm', 'inputType' => 'dropDownList', 'displayValueConfig' => $fields, 'data' => $fields ]; } ], // editable net column [ 'class'=>'kartik\grid\EditableColumn', 'attribute'=>'net', 'editableOptions'=>[ 'header'=>'Net', 'inputType'=>'textInput', 'options'=>['pluginOptions'=>['min'=>1, 'max'=>60]] ], 'hAlign'=>'right', 'vAlign'=>'middle', 'width'=>'50px' ], // editable team column [ 'class'=>'kartik\grid\EditableColumn', 'attribute'=>'team', 'editableOptions'=>[ 'header'=>'Team #', 'inputType'=>'textInput', 'options'=>['pluginOptions'=>['min'=>1, 'max'=>5]] ], 'hAlign'=>'right', 'vAlign'=>'middle', 'width'=>'50px' ], // 'team', // 'notes:ntext', ['class' => 'yii\grid\ActionColumn'], ], 'storage'=>DynaGrid::TYPE_SESSION, 'theme'=>'panel-danger', 'gridOptions'=>[ 'dataProvider'=>$dataProvider, 'filterModel'=>$searchModel, 'panel'=>['heading'=>'<h3 class="panel-title">Library</h3>'], ], 'options'=>['id'=>'dynagrid-1'] // a unique identifier is important ]); ?> This gives me a column that links to players/index&registrationID=29 My problem here is that I can't seem to get the GridView for Players to filter results so only players with a registrationID = 29 will show up. PlayersController: public function actionIndex() { $searchModel = new PlayersSearch(); if (isset($_GET['registrationID'])) $searchModel->attributes = $_GET['registrationID']; $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, ]); } PlayersSearchModel: public function search($params) { $query = players::find(); // add conditions that should always apply here $dataProvider = new ActiveDataProvider([ 'query' => $query, ]); // setup sorting attributes BEFoRE $this->load($params) $dataProvider->setSort([ 'attributes' =>[ 'ID', 'registrationID', 'fullName' => [ 'asc' => [ 'first' => SORT_ASC, 'last' => SORT_ASC], 'desc' => [ 'first' => SORT_DESC, 'last' => SORT_DESC], 'label' => 'Full Name', 'default' => SORT_ASC ], 'email', 'phone', 'city', 'state', ] ]); if (isset($_GET['PlayersSearch']) && !($this->load($params) && $this->validate())) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); $query->joinWith(['registration']); return $dataProvider; } // grid filtering conditions $query->andFilterWhere(['ID' => $this->ID]); $query->andFilterWhere(['registrationID' => $this->registrationID]); $query->andFilterWhere(['first' => $this->first]); $query->andFilterWhere(['last' => $this->last]); $query->andFilterWhere(['email' => $this->email]); $query->andFilterWhere(['phone' => $this->phone]); $query->andFilterWhere(['city' => $this->city]); $query->andFilterWhere(['state' => $this->state]); $query->andWhere('first LIKE "%' . $this->fullName . '%" ' . 'OR last LIKE "%' . $this->fullName . '%"'); return $dataProvider; }
  5. I have two tables: -players -registrations Each Registrations record can have many Players associated with it. My registration/create action gives me a syntax error: syntax error, unexpected '$registration' (T_VARIABLE)Can someone help me see what I'm doing wrong to make this work? It's one of the biggest pieces of the puzzle I need to work locally before I can see if it works online. I created a controller named RegistrationController.php <?php namespace backend\controllers; use Yii; use backend\models\Registrations; use backend\models\Players; use backend\models\search\RegistrationsSearch; use yii\web\Controller; use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; use yii\helpers\Json; use yii\helpers\ArrayHelper; use yii\base\Exception; /** * RegistrationController implements the CRUD actions for registration and players models. */ class RegistrationController extends Controller { public function actionCreate() { $registration = new Registrations(); $players = []; for ($i = 0; $i < 5; $i++) { $players[] = new Players(); } if ($registration->load(Yii::$app->request->post()) { $registration->save(); } if (Model::loadMultiple($players, Yii::$app->request->post()) { foreach ($players as $player) { $player->regsitrationID = $registration->ID; $player->save(); } } return $this->render('create',[ 'registration'=>$registration, 'players' => $players, ]); } } My create.php is the standard and rendersPartial _form.php (which is below): <?php use yii\helpers\Html; use yii\widgets\ActiveForm; use yii\web\View; use backend\models\registration; use backend\models\players; use backend\models\registrations; /* @var $this yii\web\View */ /* @var $model backend\models\registration */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="form"> <?php $form=$this->beginWidget('CActiveForm', array( 'id'=>'user-form', 'enableAjaxValidation'=>false, )); ?> <p class="note">Fields with <span class="required">*</span> are required.</p> <div class="row"> <?= $form->field($registration, 'transactionID')->hiddenInput(['value'=>'2'])->label(false) ?> <?= $form->field($registration, 'divisionLevelID')->dropDownList($model->DivisionLevelAssignmentList, [ 'prompt' => 'Please Choose One' ]);?> <?= $form->field($registration, 'field')->dropDownList($model->FieldsList, [ 'prompt' => 'Please Choose One' ]);?> <?= $form->field($registration, 'net')->textInput() ?> <?= $form->field($registration, 'team')->textInput() ?> <?= $form->field($registration, 'notes')->textarea(['rows' => 6]) ?> </div> ////////////////////////////////////////////////////// <h2>Player 1 Info</h2> <div class="row"> <?= $form->field($players, '[]first')->textInput(['maxlength' => true]) ?> <?= $form->field($players, '[]last')->textInput(['maxlength' => true]) ?> <?= $form->field($players, '[]phone')->textInput(['maxlength' => true]) ?> <?= $form->field($players, '[]email')->textInput(['maxlength' => true]) ?> </div> ////////////////////////////////////////////////////// <h2>Player 2 Info</h2> <div class="row"> <?= $form->field($players, '[]first')->textInput(['maxlength' => true]) ?> <?= $form->field($players, '[]last')->textInput(['maxlength' => true]) ?> <?= $form->field($players, '[]phone')->textInput(['maxlength' => true]) ?> <?= $form->field($players, '[]email')->textInput(['maxlength' => true]) ?> </div> ////////////////////////////////////////////////////// <h2>Player 3 Info</h2> <div class="row"> <?= $form->field($players, '[]first')->textInput(['maxlength' => true]) ?> <?= $form->field($players, '[]last')->textInput(['maxlength' => true]) ?> <?= $form->field($players, '[]phone')->textInput(['maxlength' => true]) ?> <?= $form->field($players, '[]email')->textInput(['maxlength' => true]) ?> </div> ////////////////////////////////////////////////////// ////////////////////////////////////////////////////// <h2>Player 4 Info</h2> <div class="row"> <?= $form->field($players, '[]first')->textInput(['maxlength' => true]) ?> <?= $form->field($players, '[]last')->textInput(['maxlength' => true]) ?> <?= $form->field($players, '[]phone')->textInput(['maxlength' => true]) ?> <?= $form->field($players, '[]email')->textInput(['maxlength' => true]) ?> </div> ////////////////////////////////////////////////////// <?php $this->endWidget(); ?> </div><!-- form -->
  6. Is there, or shouldn't there be, a place to post potential Errata for the Yii2 book? I've stumbled across a few things here and there and don't see them mentioned in the forum. For instance, on page 684 (as of the PDF versioin I have which I just dowloaded) there are references to the "protected/views/site/pages/company" path. But the Yii2 book and the documentation specify that the "protected" folder has been eliminated.This just leads to confusion in what can be an already-confusing quest for a MVC and Yii noobie. Thanks
  7. Larry, Do you have any more chapters of the Yii Book? I mean the second edition, revised for Yii 2. I've read -- and mostly understood -- up to page 190, which is the last revised page. If you have more revised chapters, I'd be interested in reading them. No doubt, other readers would too. Can you post any additional chapters on your website and let everyone know? Thanks.
  8. Larry, on page 150 of the YiiBook2 (latest version), you write that the following code is "verbose, redundant, and illogical": $model = new Page(); $model = $model->findOne($id); Instead of creating an instance of the Page class, as shown above, you say we should use a static class instance (or static method?), like this: if (($model = Page::findOne($id)) !== null) { return $model; etc. I don't understand why the first example is "verbose, redundant, and illogical", and why the second example is preferred. Can you please explain this? Thanks.
×
×
  • Create New...