Jump to content
Larry Ullman's Book Forums

distortionzzz

Members
  • Posts

    8
  • Joined

  • Last visited

Posts posted by distortionzzz

  1. Hi all,

     

    The more I'm dabbling with Yii, I'm disliking accessRules, it doesn't seem to work how I would like it and it is quite limiting, I don't like having to define specific usernames which can access an action.

     

    I read an article on the Yii website which I can link to if I'm allowed. Showing how you can very simply perform a check from each individual actions method (1 line of code and a new method in the base Controller class). I just wanted to get some opinions and find out how other people get around this.

     

    Thanks

    Simon

  2. Hi again,

     

    I can't believe I solved this only minutes after asking for help :P

     

    I simply added the below to the UrlManager

     

     

    'register'=>'/user/register'

     

    And I thought I had to do something fancy

     

    Thanks Anyway

    • Upvote 1
  3. Hi everyone,

     

    I'm going slightly beyond the scope of part 1 of this book. I want to create my own routes, an example being. Instead of /user/register, I want to use just /register.

     

    I thought i could just modify the URL Manager config and add something like this:

     

    '<action:\w+>'=>'<controller>/<action>',

     

    This wouldn't have been an ideal solution anyway incase of duplicate action names. Does anyone have a solution to this. Some kind of override.

     

    Thank you.

  4. Hi Lou,

     

    What Edward is saying is correct, the reason the 2nd, 3rd, 4th etc, errors are appearing below the footer, is because the 1st error is showing the header then the error then the footer.

     

    The 2nd error is then display just the error below the footer and not showing the header and footer again because you are using require_once().

     

    The solution: remove all includes/requires from the error handler and let the core of your site handle these includes. Am I correct in assuming that you're worried that if there is an error before the header has been loaded you will get an ugly looking error message with no styling?

     

    You shouldn't worry about this to much as any system files you modify should be heavily tested before publish to a production environment. However if it does really bug you, you could store the errors in an array and then once the header has been loaded loop over them and print them to screen. Do this you will need to check the header hasn't already been loaded because if it has you would need to show the errors instantly.

     

    Regards

    • Upvote 2
  5. Hi all,

     

    I used these forum long ago and I can no longer remember my login creds..... anyway this question isn't really about this book, but I felt it would go best in the "Quickpro" arena.

     

    I'm wondering how you MVC users approach data handling. I'll create a simple scenario

     

    - 3 Tables (a, b and c)

    - Table a joins to table b which joins to table c

    - I have a query which selects all "a" rows and how many "b" and "c" rows match each "a" row.

     

    I steering clear of any ORM's for now and I'm using ->fetchObject in PDO mapping the data to the "a" model.

     

    The Problem

     

    The "a" model doesn't have an attribute for "total b rows" or "total c rows", is it ok by MVC law to store this data in the "a" object or should it be stored somewhere else, if so where?

     

    Thanks for reading and hopefully replying

     

    Simon

×
×
  • Create New...