Jump to content
Larry Ullman's Book Forums

Brent Knigge

  • Content Count

  • Joined

  • Last visited

  • Days Won


Brent Knigge last won the day on April 18 2016

Brent Knigge had the most liked content!

Community Reputation

2 Neutral

About Brent Knigge

  • Rank
  1. Have a look at Charles Proxy. I use this and it helps an awful lot, especially with AJAX stuff. You'll see everything going back and forth between your browser and server. The purpose of using this with your problem is to identify the POST variables and form names that are sent from your browser etc.
  2. Hello, I think this link to the documentation for loadMultiple might help. http://www.yiiframework.com/doc-2.0/yii-base-model.html#loadMultiple()-detail Maybe add the formName and see if that helps. if (FeuilleDeJourResponsable::loadMultiple($array_feuille_de_jour_responsable,Yii::$app->request->post(), 'FeuilleDeJourResponsable') ) Also check the Post data to see what the form name is, and ensure that it matches with what you're expecting. Hope this helps, Brent.
  3. Hi, There is a property called name in app. Here is a link to the documentation for $app property. http://www.yiiframework.com/doc-2.0/yii-web-application.html use a program like notepad++ that can recursively search sub-folders for Yii::$app->name and see what shows up. You'll get an idea of how it might be used. Hope that helps, Brent.
  4. I can highly recommend getting yourself a program like Charles Web Proxy. It is especially useful for helping to solve these issues because you can see everything that is being passed back and forth - especially when it comes to AJAX / CURL etc. Helped come to the same resolution you've had, and solved my puzzles in a matter of minutes instead of days. Hope that helps,
  5. Hi, The error message you are describing is a normal PHP error, not something specific to Yii. You haven't given us the actual line number of where the error has occurred, and I can't see anything that is immediately obvious (except CActiveForm). The unexpected message usually means that the prior statement is incomplete. I.e. missing semi-colons, braces etc. I would be looking for that. Here is an example (notice the missing semi-colon after 'brent'). <?php $name = 'brent' $registrations = true; This is the output when I run it: Parse error: syntax error, unexpected
  6. Essentially yes, I believe that you would need to do that for each of your actions. There are a couple of ways of doing this. You can do the access control like you've mentioned, or you could use Yii::$app->user->isGuest inside each action method to determine whether the action can be performed. You might be able to set up a 'default' access control in the config file. Haven't looked into that part yet. Hope this helps, Brent
  7. Hi, The code sample I have is for Yii2. thanks, Brent
  8. Hi, I don't think there are any access controls for a model (otherwise I'm going to be confused myself). There are 'rules', and scenarios in models and these dictate how an attribute is to be populated. There are access control (with rules) in the controller that determine how certain actions can be accessed. Access Control has rules. You don't have one with out the other. (kinda like Access control is a table, and rules are fields). Here is a basic access control that I built to try things out. So the only is for the action methods. I.e. actionCreate, actionRbac2 etc Then
  9. You could post your information here or send Larry an email directly. The idea of having an ebook that is released in multiple stages is that the mistakes you find, can be corrected in the next release. Everyone benefits. Brent.
  10. Hi Again, Looking at the code and the steps you've taken, I can now see where the issue is. In urlManager, the first rule that matches will be actioned. When you look at this url ullman.local/page/testpage1 (As per Brent's suggestion) It will actually match this rule. '<controller:\w+>/<action:\w+>' => '<controller>/<action>', but it will also match this one 'page/<view:\w+>'=>'site/page', So which ever rule you have first, is the one that will be actioned. This is what is happening here, and Yii is trying to find a contr
  11. hi, The directory needs to be this: E:\xampp\htdocs\ullman\views\site\pages\testpage1.php Notice that it is pages not page. You still access through the same url as I mentioned before. I.e. ullman.local/page/testpage1 this link to the documentation explains that the default directory in use is pages unless otherwise specified. You reference thru page because that is what we have set up in the urlManager. P.S. I've been through the same learning curve with static pages as you, but once you get it you'll be wondering why it just didn't click in the first place.
  12. Hi, Thanks Larry I got myself a little bit confused looking at the 'about' page and figuring out the route. Now that i have looked at a different static page (not part of site), I am okay (and feel a little silly). Okay first up, your actions method has the array elements error, captcha and page. This is like having methods actionError, actionCaptcha and actionPage. Except that instead of coding our own methods, we are pointing each one to a class to handle the particular action. So when we call the action page it knows to use the ViewAction class to handle the action. Okay now
  13. Hi, yiistuff is just an alias that I created in Apache. I have several (yiistuff1, yiistuff2 etc) set up that helps mimic what i would have on a server. Try experimenting with the url that you are using. You need to remove the view and probably page as well. so that you have ullman.local/site/about That should work. Brent
  14. Hi, You need to modify the routes in the urlManager to work with static pages. here is what I have added 'page/<view:\w+>'=>'site/page', This means I can navigate to http://localhost/yiistuff/site/aboutand the proper page shows up. Here are some notes from my Action method that might help //I added this for displaying static pages... //now I can goto ...site/page?view=hello //if you want pretty urls, you can change in the urlManager like so. //'page/<view:\w+>'=>'site/page', //which means navigat
  15. Hello, You need to use the getDB method of the ActiveRecord class. http://www.yiiframework.com/doc-2.0/yii-db-activerecord.html#getDb()-detail If you wanted your model code to switch between different DB, then I suppose you could set a public attribute in the model which would then could be returned from getDB. There is some more information here: http://stackoverflow.com/questions/27254540/yii-2-0-multiple-database-connection Hope that helps, brent
  • Create New...