Welcome Guest, Not a member yet? Register   Sign In
Using libraries alongside models
#2

(This post was last modified: 03-29-2015, 06:14 PM by cartalot.)

you could probably take a bunch of the code in your Product controller and refactor it into a Products model.

so then in any controller you could have something really simple like

PHP Code:
if ( ! $products $this->products->returnProductsBy($category) ){

 
    $this->showNoProductsBlogPost() ; } 

else{
$this->showBlogPostWith($products) ;  

personal preference: i'm not calling any views, they are in separate methods. this adds a few lines of code but it makes it much easier to maintain.
Reply


Messages In This Thread
Using libraries alongside models - by mdixon18 - 03-29-2015, 04:06 PM
RE: Using libraries alongside models - by cartalot - 03-29-2015, 06:10 PM
RE: Using libraries alongside models - by RWCH - 04-03-2015, 07:17 AM
RE: Using libraries alongside models - by gadelat - 04-03-2015, 08:31 AM
RE: Using libraries alongside models - by RWCH - 04-07-2015, 03:44 AM
RE: Using libraries alongside models - by RWCH - 04-07-2015, 03:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB