ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Don't Repeat Yourself in CI doesn't exist

February 24, 2009 3:46am

Subscribe [9]
  • #16 / Mar 26, 2009 6:18am

    winter

    16 posts

    @gh0st

    In your example of the car,  to produce this as DRY you would store a ‘model’ of the car properties and thier database locations in a model file.

    Pull the car ‘model’ and use the fields to carry out the select and data return in your DB query and again to populate the fields in the view.

    This way, when you change the properties of the car, you only have to change the ‘model’ and the DB query and view will change automatically.

    Of course, you would still need to add the relevant fields to the relevant tables.

    This technique is handy for building generic forms - I am working on one at the moment, if I ever get a chance to finish it, I will publlish it in the wiki

    DRY is possible with CI, but somtimes you need to make one more lateral thought step.

    obiron

    Sorry to butt in here, but that sounds really cool. If anyone has some working code examples or tutorials, I’d really enjoy seeing them.

    Cheers!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases