Magento - include multiple external libraries to Admin Controller actions
-
01-10-2020 - |
سؤال
I am working on import price of products using xls, xlsx, ods and csv files.
For that i need to read these file, i had use seperate external library files to read those files.
It works well in my local machine, when i move it to server my admin controller doesn't work, it displays blank page.
I found that is because i have included external library files in my admin controller.(when i command those lines controller works fine in server)
so then i have used below format to include lib files :
require_once(Mage::getBaseDir('lib'). DS . '[folder_name]/easyODS.php');
require_once(Mage::getBaseDir('lib'). DS . '[folder_name]/simplexlsx.class.php');
require_once(Mage::getBaseDir('lib'). DS . '[folder_name]/reader.php');
after this change xlsx, ods and csv(i didn't use lib file for csv) working fine but xls doesn't.
kindly give me suggestion to do this stuff.
المحلول
I have fixed the issue...simple thing i have done
i have changed the below line in my library file that i used to read .xls file
the line is :
function Spreadsheet_Excel_Reader()
{
$this->_ole =& new OLERead();
$this->setUTFEncoder('iconv');
}
Changed To
function Spreadsheet_Excel_Reader()
{
$this->_ole = new OLERead();
$this->setUTFEncoder('iconv');
}
I have just removed the '&'(ampersand) from the line. Problem Solved!!!... Now it is working well.
نصائح أخرى
First of all debug the path :
require_once(Mage::getBaseDir('lib'). DS . '[folder_name]/easyODS.php');
the path which is created able to open file in browser? and then try to add relative path of the file.