Page 6 of 6 FirstFirst ... 456
Results 51 to 58 of 58

Thread: In this thread we will discuss CodeIgniter!

  1. #51
    Join Date
    Feb 2003
    Posts
    3,184
    Rep Power
    0

    Default

    Data Paging: Page 1, Page 2, Page 3 for the blog posts and probably the comments.

    The organisation of the files makes it more manageable for who? could be for the programmer. IMHO putting the related view and controller in the same folder maybe more manageable in some cases especially with lots of views on the same data.

    So if the validation is in the model how do you update specific columns?

  2. #52
    Join Date
    Jun 2008
    Posts
    74
    Rep Power
    0

    Default

    Quote Originally Posted by owen View Post
    Data Paging: Page 1, Page 2, Page 3 for the blog posts and probably the comments.

    The organisation of the files makes it more manageable for who? could be for the programmer. IMHO putting the related view and controller in the same folder maybe more manageable in some cases especially with lots of views on the same data.

    So if the validation is in the model how do you update specific columns?
    I have already implemented pagination. You can sign up n try to add as many entries as possible and see. I think i set it at 10 blog posts per page and 20 comments per page for each blog view.

    It is a programmer that will be updating the code or implementing new features so "The organisation of the files makes it more manageable for who? could be for the programmer." only makes sense.

    For Yii, the convention is that a view maps to a controller action so you will always know where to find what you need. Separating the views from the controller and decoupling it from the data makes the views reusable by other controllers etc...

    If you have lots of views on the same data, then you will most likely be rendering each view from a different controller action. A controller action can render any view regardless of where it is placed. Imagine if you have to deal with 30 controllers in a folder, each with at least 3 actions that render a different view. Following the approach from your opinion, you would have 120 files easily in one folder. That's not manageable when you are searching for specific files. When you have a lot of files in a single directory, it is likely that name conflicts may occur then you may end up giving files ugly names like view1.php, view2.php etc...

    There are a few ways in which I can do that.

    Say I access a record user with fields id, username, password. The record of the id is 1.

    I load this record by calling:

    PHP Code:
    $user User::model()->findByAttributes(array('id'=>1)); 
    I want to change the password of this record to 12345.

    I can do:

    PHP Code:
    $user->password '12345';
    $user->save();// this will return true or false. The save method will call the validate method. If it fails because of a validation error. You can access the errors in $user->getErrors(); 
    or i can do
    PHP Code:
    $user->saveAttributes(array('password'=>'12345'));// this will alse return true or false but does not call the validate method. 
    I use save() when I am saving data that comes from the user.

    I use saveAttributes when I am implicitly saving data in the application that will never need validation.
    Last edited by jayrulez; Mar 17, 2011 at 09:26 PM. Reason: Didn't answer all your qstns.

  3. #53
    Join Date
    Mar 2011
    Posts
    485
    Rep Power
    0

    Default

    Noob here. Looking forward to the discussion forking over to yii.

  4. #54
    Join Date
    Jun 2003
    Posts
    1,464
    Rep Power
    0

    Default

    Quote Originally Posted by datdread View Post
    Noob here. Looking forward to the discussion forking over to yii.
    hehe yea me too .. been keeping a close eye on Yii but want someone with more experience to evaluate.

  5. #55
    Join Date
    Jun 2009
    Posts
    40
    Rep Power
    0

    Default

    Quote Originally Posted by CyVan View Post
    hehe yea me too .. been keeping a close eye on Yii but want someone with more experience to evaluate.
    This is the CodeIgniter thread!

    Also, can we change the topic title to the correct spelling?

  6. #56
    Join Date
    Feb 2003
    Posts
    3,184
    Rep Power
    0

    Default

    Sorry I was away and could not afford to buy gas to come back.

    anyway @Stutch last thing did you manage to implement the paging for the posts? and when you enter a comment the page goes blank. I'll start the other thread (which probably isn't necessary now but so it go)

  7. #57
    Join Date
    Jun 2009
    Posts
    40
    Rep Power
    0

    Default

    Quote Originally Posted by owen View Post
    anyway @Stutch last thing did you manage to implement the paging for the posts? and when you enter a comment the page goes blank.
    I hadn't implemented commenting yet either hence the blank page. Will see if I have some time to put them in today.

  8. #58
    Join Date
    Jun 2008
    Posts
    74
    Rep Power
    0

    Default

    I took the blog down. Just a FYI. Needed that dedicated ip address for something else.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •