CSV Spreadsheet and Datafeed Loader.


 A datafeed is any character delimited text file with 3 or more fields per line. Other delimiters may also be used. The first row must always contain the column header field names for it to be a proper datafeed. Note that the csv parser must be loaded before using.

filename (string) may either be php$ variable or string value.

delimiter(string) is the separator between the fields in each row.

Example: the data file csv_datafeed.txt contains:


The following code will import the datafeed or csv file and deserialize it into variable memory. Field names are populated to the matrix_fields array. Arrays with names corresponding to column field names will be created and populated with the row values. Note that the csv parser function must be loaded first by the cablebox front controller.


Example assumes that the matrix fields(column headers) from the csv file are name, id,colors and size. Use php  print_r to test dump the variables:


Note that since the pipe symbol is a reserved delimiter in the TerraDctl shortcodes, it should not be used inside a shortcode for anything other than separating  parameters.  For pipe delimited files:


The csv parser loaded by the front controller includes the TerraDctl php extension parse_csv().

direct usage:


Nests all the row and column values into 2 dimensional indexed arrays.