Search Results

Search found 1 results on 1 pages for 'yahyae'.

Page 1/1 | 1 

  • Codeigniter Model appending word_limiter to result object

    - by yahyaE
    I have a get_all function in my model class in Codeigniter 2.0+. For a given database field name, i need to use word_limiter() in text helper. In view page, i loop result set as object $row->field_name_to_be_limited. With below code, i am trying to do it. But i should include the change $q->$field_name = word_limiter($q->$field_name, 4); into the $q->result. Thanks for help. function get_all($table_name,$orderByField,$ascDesc,$field_name = '') { $this->load->helper('text'); $qOrder = $this->db->order_by($orderByField,$ascDesc); $q = $this->db->get($table_name,$qOrder); if( ! $field_name ==='') $q->$field_name = word_limiter($q->$field_name, 4); return $q->result(); }

    Read the article

1