Welcome Guest, Not a member yet? Register   Sign In
Displaying images in a generated table.
#1

[eluser]Unknown[/eluser]
I am new to codeigniter and finding it fantastic. I am trying to use an autogenerated table to display a bunch of products in a shop, one of the obvious things if the product picture. I cant seem to find any help on this subject so here is what I have deduced but it does not work...

Code:
function index ()
{
  /* Load the order information and create a table of the results.*/
  
  $this->load->model('FabricModel');
  $Manufacturer = "Supplier";
  
  $OrderData = $this->FabricModel->AllFabrics($Manufacturer);
  
  $this->table->set_heading('Picture', 'Design', 'Colourway', 'Fabric Code', 'Fabric Width', 'Pattern Repeat', 'RRP','Buy');
    
  foreach( $OrderData as $row)
  {
   $image_properties = array(
    'src' => '$row->Picture',
    'width' => '100',
    'height' => '100'
    );
   $img = img($image_properties);
  
   $this->table->add_row(
   $img,
   $row->Design,
   $row->Colourway,
   $row->DesignCode,
   $row->FabricWidth,
   $row->PatternRepeat,
   $row->RRP
   );
  }
  $data['detail'] = $this->table->generate();
  
  /* display output. */
  
  $data['title'] = "FABRIC";
  $data['intro'] = "<p>Some Text.</p>";
  $this->load->view('top_template');
  $this->load->view('fabric', $data);
  $this->load->view('bottom_template');
}

This is my controller. The view outputs the table if I don't put anything in about image. Please help me..
#2

[eluser]Unknown[/eluser]
Sorry did not realise about code tags. Have added them to post now....




Theme © iAndrew 2016 - Forum software by © MyBB