V
V
vladroots2018-10-08 16:23:05
1C-Bitrix
vladroots, 2018-10-08 16:23:05

How to display a csv file on a page with pagination in Bitrix?

Good afternoon! Tell me it is possible to implement the following: there is a csv file the size is 400mb. I do not want to fill the database with such a volume, since the data will change every month. I want to decide just by replacing a fresh file every month.
Is it possible to display information from csv on a page with filtering by fields and pagination, for example, 100 lines?

require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/classes/general/csv_data.php");
$csvFile = new CCSVData('R', true);
$csvFile->LoadFile($_SERVER["DOCUMENT_ROOT"]."/baza/my.csv");
$bFirstHeaderTmp = $csvFile->GetFirstHeader();
$csvFile->SetDelimiter(',');
while ($arRes = $csvFile->Fetch()) {
}

I found a piece of code in the open spaces, but there are not enough server resources to read such a volume. Tell me where to go? I would be grateful for the finished piece of code. Thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene Pukha, 2018-10-08
@summoner2015

In this case, you can do without a database, but this is a very crutch option:
It seems to me that it is better to use a table in the database, which will be cleared when a new csv is imported.

E
eternalfire, 2018-10-08
@eternalfire

it is impossible, only in the database, do you suggest reading a 400mb file each time when loading the page?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question