Display Barcode for each Item in view Codeigniter using zend barcode framework -


i have develop software shop. have list of product having price , barcode digits. want show each , every items in product list html page along barcode take print of barcode on stickers.

i googled zend barcode rendering , tested , found result ok 1 barcode here mai problem arise want generate multiple barcode in foreach loop on view->page.

i new codeigniter please help.

my controller 'barcode.php'.

<?php defined('basepath') or exit('no direct script access allowed');  class barcode extends ci_controller {  public function __construct(){      parent::__construct();     if($this->session->userdata('successful_logged_in')){         //load library         $this->load->library('zend');         //load in folder zend         $this->zend->load('zend/barcode');         $this->load->model('common_model');     }     else{         redirect('login','refresh');             } }  public function index(){     //generate 13 digit random number render barcode     $temp = rand(1111111111111,9999999999999);     $this->set_barcode($temp);      $table='item_master';     $order_by='name asc';     $data['item_list']=$this->common_model->select_active_records($table,$order_by);     $this->load->view('home/header');     $this->load->view($this->router->fetch_class().'/records',$data);     $this->load->view('home/footer'); }  public function set_barcode($code){     //generate barcode     zend_barcode::render('code128', 'image', array('text'=>$code), array()); } 

in view 'records.php'.

<tbody>'; $i=1; if($item_list==false){     echo '<tr class="text-danger"><td colspan="3"><strong<i class="fa fa-info-circle" style="font-size:12pt;"></i> - no record found</td></tr>';     }     else{         foreach ($item_list $row){                 echo '<tr>';         echo '<td>'.$i++.'</td>';         echo '<td>'.$row->name.'</td>';         echo '<td>'.$row->price.'</td>';         echo '<td>'.$row->barcode.'</td>';         echo '</tr>';     } } echo' </tbody> 

but shows me 1 barcode on entire html body page generated random number

i want final result this expected result


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -