issue with PHPExcel_Reader_

Topics: Developer Forum, Project Management Forum, User Forum
Jan 9, 2014 at 11:24 AM
I have this function in a class called home_view:
public function frequent_table(){

    $filename='../data/Estratti.csv';

    if (!file_exists($filename)) {
        die("File $filename does not exist.<br />");
    }

    $objPHPExcel = PHPExcel_IOFactory::load("../data/Estratti.csv");
    $reader = new PHPExcel_Reader_Excel5();
            $objWorksheet = $objPHPExcel->getActiveSheet();
    $lastRow = $objPHPExcel->getActiveSheet()->getHighestRow();

    $ESTRAZ=array();    
    $CONCORSO=array();  
    $BA1=array();   
    $BA2=array();   
    $BA3=array();   
    $BA4=array();   
    $BA5=array();   
    $CA1=array();   
    $CA2=array();   
    $CA3=array();   
    $CA4=array();   
    $CA5=array();   
    $FI1=array();   
    $FI2=array();   
    $FI3=array();   
    $FI4=array();   
    $FI5=array();   
    $GE1=array();   
    $GE2=array();   
    $GE3=array();   
    $GE4=array();   
    $GE5=array();   
    $MI1=array();   
    $MI2=array();   
    $MI3=array();   
    $MI4=array();   
    $MI5=array();   
    $NA1=array();   
    $NA2=array();   
    $NA3=array();   
    $NA4=array();   
    $NA5=array();   
    $PA1=array();   
    $PA2=array();   
    $PA3=array();   
    $PA4=array();   
    $PA5=array();   
    $RM1=array();   
    $RM2=array();   
    $RM3=array();   
    $RM4=array();   
    $RM5=array();   
    $TO1=array();   
    $TO2=array();   
    $TO3=array();   
    $TO4=array();       
    $TO5=array();   
    $VE1=array();   
    $VE2=array();   
    $VE3=array();   
    $VE4=array();   
    $VE5=array();   
    $NZ1=array();   
    $NZ2=array();           
    $NZ3=array();       
    $NZ4=array();   
    $NZ5=array();

    $bari=array($BA1,$BA2,$BA3,$BA4,$BA5);
    $catania=array($CA1,$CA2,$CA3,$CA4,$CA5);
    $firenze=array($FI1,$FI2,$FI3,$FI4,$FI5);
    $genova=array($GE1,$GE2,$GE3,$GE4,$GE5);
    $milano=array($MI1,$MI2,$MI3,$MI4,$MI5);
    $napoli=array($NA1,$NA2,$NA3,$NA4,$NA5);
    $palermo=array($PA1,$PA2,$PA3,$PA4,$PA5);
    $roma=array($RM1,$RM2,$RM3,$RM4,$RM5);
    $torino=array($TO1,$TO2,$TO3,$TO4,$TO5);
    $venezia=array($VE1,$VE2,$VE3,$VE4,$VE5);
    $nazionale=array($NZ1,$NZ2,$NZ3,$NZ4,$NZ5);

    for ($col = 0; $col < count($bari); $col++){
        for ($row = 1; $row <= $lastRow +1; $row++){
            $bari[$col][$row -1]=$objWorksheet->getCellByColumnAndRow($col,$row)->getValue();           
        }           
    }

    for ($col = 0; $col < count($catania); $col++){
        for ($row = 1; $row <= $lastRow +1; $row++){
            $catania[$col][$row -1]=$objWorksheet->getCellByColumnAndRow($col,$row)->getValue();            
        }           
    }

    for ($col = 0; $col < count($firenze); $col++){
        for ($row = 1; $row <= $lastRow +1; $row++){
            $firenze[$col][$row -1]=$objWorksheet->getCellByColumnAndRow($col,$row)->getValue();            
        }           
    }

    for ($col = 0; $col < count($genova); $col++){
        for ($row = 1; $row <= $lastRow +1; $row++){
            $genova[$col][$row -1]=$objWorksheet->getCellByColumnAndRow($col,$row)->getValue();         
        }           
    }

    for ($col = 0; $col < count($milano); $col++){
        for ($row = 1; $row <= $lastRow +1; $row++){
            $milano[$col][$row -1]=$objWorksheet->getCellByColumnAndRow($col,$row)->getValue();         
        }           
    }

    for ($col = 0; $col < count($napoli); $col++){
        for ($row = 1; $row <= $lastRow +1; $row++){
            $napoli[$col][$row -1]=$objWorksheet->getCellByColumnAndRow($col,$row)->getValue();         
        }           
    }

    for ($col = 0; $col < count($palermo); $col++){
        for ($row = 1; $row <= $lastRow +1; $row++){
            $palermo[$col][$row -1]=$objWorksheet->getCellByColumnAndRow($col,$row)->getValue();            
        }           
    }

    for ($col = 0; $col < count($roma); $col++){
        for ($row = 1; $row <= $lastRow +1; $row++){
            $roma[$col][$row -1]=$objWorksheet->getCellByColumnAndRow($col,$row)->getValue();           
        }           
    }

    for ($col = 0; $col < count($torino); $col++){
        for ($row = 1; $row <= $lastRow +1; $row++){
            $torino[$col][$row -1]=$objWorksheet->getCellByColumnAndRow($col,$row)->getValue();         
        }           
    }

    for ($col = 0; $col < count($venezia); $col++){
        for ($row = 1; $row <= $lastRow +1; $row++){
            $venezia[$col][$row -1]=$objWorksheet->getCellByColumnAndRow($col,$row)->getValue();            
        }           
    }

    for ($col = 0; $col < count($nazionale); $col++){
        for ($row = 1; $row <= $lastRow +1; $row++){
            $nazionale[$col][$row -1]=$objWorksheet->getCellByColumnAndRow($col,$row)->getValue();          
        }           
    }
    $count_bari=array_count_values($bari);
    $count_catania=array_count_values($catania);
    $count_firenze=array_count_values($firenze);
    $count_genova=array_count_values($genova);
    $count_milano=array_count_values($milano);
    $count_napoli=array_count_values($napoli);
    $count_palermo=array_count_values($palermo);
    $count_roma=array_count_values($roma);
    $count_torino=array_count_values($torino);
    $count_venezia=array_count_values($venezia);
    $count_nazionale=array_count_values($nazionale);

    arsort($count_bari);
    arsort($count_catania);
    arsort($count_firenze);
    arsort($count_genova);
    arsort($count_milano);
    arsort($count_napoli);  
    arsort($count_palermo);
    arsort($count_roma);
    arsort($count_torino);
    arsort($count_venezia);
    arsort($count_nazionale);

    $keys_bari=array_keys($count_bari);
    $keys_catania=array_keys($count_catania);
    $keys_firenze=array_keys($count_firenze);
    $keys_genova=array_keys($count_genova);
    $keys_milano=array_keys($count_milano);     
    $keys_napoli=array_keys($count_napoli);
    $keys_palermo=array_keys($count_palermo);
    $keys_roma=array_keys($count_roma);
    $keys_torino=array_keys($count_torino);
    $keys_venezia=array_keys($count_venezia);
    $keys_nazionale=array_keys($count_nazionale);

    $frequent_bari=$keys_bari[0][1];
    $frequent_catania=$keys_catania[0][1];
    $frequent_firenze=$keys_firenze[0][1];
    $frequent_genova=$keys_genova[0][1];
    $frequent_milano=$keys_milano[0][1];
    $frequent_napoli=$keys_napoli[0][1];
    $frequent_palermo=$keys_palermo[0][1];
    $frequent_roma=$keys_roma[0][1];
    $frequent_torino=$keys_torino[0][1];
    $frequent_venezia=$keys_venezia[0][1];
    $frequent_nazionale=$keys_nazionale[0][1];
}

and a page that uses it

<?php
include_once "../aliengine/home_view.php";
$view = new home_view();
$view->frequent_table();
echo '<pre> debug';
echo $frequent_bari;
echo $frequent_catania;
echo $frequent_firenze;
echo $frequent_genova;
echo $frequent_milano;
echo $frequent_napoli;
echo $frequent_palermo;
echo $frequent_roma;
echo $frequent_torino;
echo $frequent_venezia;
echo $frequent_nazionale;

echo '</pre>';

?>

when i load the page instead of the expected output I have an error:

Fatal error: Class 'PHPExcel_Reader_' not found in /var/www/studionx.aliengine.it/htdocs/phpexcel/Classes/PHPExcel/IOFactory.php on line 170

please help
Coordinator
Jan 11, 2014 at 2:37 PM
The only circumstance in which this error could occur is if no Reader name or an empty Reader name was passed when instantiating the reader