title: CodeIgniter: How to pass variables to a model while loading
body: <p>In CI, I have a model...</p>
  
  <pre><code>&lt;?php
  
  class User_crud extends CI_Model {
  
  var $base_url;
  var $category;
  var $brand;
  var $filter;
  var $limit;
  var $page_number;
  
  public function __construct($category, $brand, $filter, $limit, $page_number) {
      $this-&gt;base_url = base_url();
      $this-&gt;category = $category;
      $this-&gt;brand = $brand;
      $this-&gt;filter = $filter;
      $this-&gt;limit = $limit;
      $this-&gt;page_number = $page_number;
  }
  
  public function get_categories() {
      // output
      $output = "";
      // query
      $this-&gt;db-&gt;select("name");
      $this-&gt;db-&gt;from("categories");
      $query = $this-&gt;db-&gt;get();
      // zero
      if ($query-&gt;num_rows() &lt; 1) {
          $output .= "No results found";
          return $output;
      }
      // result
      $output .= "&lt;li&gt;&lt;a class=\"name\"&gt;Categories&lt;/a&gt;&lt;/li&gt;\n";
      foreach ($query-&gt;result_array as $row) {
          $output = "&lt;li&gt;&lt;a href=\"\"&gt;{$row['name']}&lt;/a&gt;&lt;/li&gt;\n";
      }
      return $output;
  }
  </code></pre>
  
  <p>while I am calling this in my controller...</p>
  
  <pre><code>&lt;?php
  
  class Pages extends CI_Controller {
  
  // home page
  
  public function home() {
  }
  
  // products page
  
  public function products($category = "cell phones", $brand = "all", $filter = "latest") {
      // loading
      $this-&gt;load-&gt;model("user_crud");
      // 
  }
  </code></pre>
  
  <p>Now, How can I pass the <code>$category, $brand and $filter</code> variables to the <code>user_crud</code> model while loading/instantiation?</p>