Advertisement
europcsolutions

FuelPHP Accent Problem

Feb 12th, 2013
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.17 KB | None | 0 0
  1. Controller :
  2. -------------
  3.  
  4. <?php
  5.  
  6. class Controller_Commercial_DicoDonnees extends Controller_Base
  7. {
  8.  
  9.     public function action_index()
  10.     {
  11.         $handle = fopen( Uri::base() . "assets/dico-donnees.csv", "r" );
  12.         $row = 1;
  13.         $csv = array();
  14.  
  15.         while( ( $data = fgetcsv( $handle, 5000, "," ) ) !== FALSE )
  16.         {
  17.             if( $row == 1 )
  18.                 $csv['headers'] = $data;
  19.             else
  20.                 $csv['content'][] = $data;
  21.            
  22.             $row++;
  23.         }
  24.  
  25.         // Load the view
  26.         $this->template->title = "Darties &#8226; Dictionnaire des Données";
  27.         $this->template->content = View::forge( "commercial/dico-donnees", array(
  28.             "csv" => $csv
  29.         ));
  30.     }
  31.  
  32. }
  33.  
  34.  
  35. View :
  36. -------
  37.  
  38. <h2>Dictionnaire des Données</h2>
  39.  
  40. <table class="table table-bordered table-hover">
  41.     <thead>
  42.         <tr>
  43.             <?php foreach( $csv['headers'] as $header ) : ?>
  44.                 <th><?= $header ?></th>
  45.             <?php endforeach; ?>
  46.         </tr>
  47.     </thead>
  48.     <tbody>        
  49.         <?php foreach( $csv['content'] as $cell ) : ?>
  50.             <tr>
  51.                 <th><?= $cell[0] ?></th>
  52.                 <td><?= $cell[1] ?></td>
  53.                 <td><?= $cell[2] ?></td>
  54.                 <td style="width: 140px;"><?= $cell[3] ?></td>
  55.                 <td><?= $cell[4] ?></td>
  56.             </tr>
  57.         <?php endforeach; ?>           
  58.     </tbody>
  59. </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement