Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,155,870 members, 7,828,103 topics. Date: Wednesday, 15 May 2024 at 12:37 AM

Trivial Question Csv/arraycollection - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Trivial Question Csv/arraycollection (733 Views)

How To Import Contacts (using CSV) On Facebook? / Reading Different Versions Of Excel Data (CSV,XLS,XLSX) With Phpexcel Library / C# Csv Parser (2) (3) (4)

(1) (Reply) (Go Down)

Trivial Question Csv/arraycollection by Nobody: 5:46pm On Dec 06, 2012
Hi Guys yes Pc Guru has come with his wahala again, i wrote a PHP CommandLine to extract a CSV which was converted from an Excel file containing Multi-choice questions for Moodle (a Learning management system) however, because of the time limit, i won't lie the scripts works but its more 100% hardcoded but now the job is done, and subsequent request like this will obviously come, the question is i have decided to write a class that dumps CSV to a good Data Structure, the Dilemma is

1. Should i take the CSV and Dump to a ArrayCollection (i know PHP has no such) this will be a lot easier, and make each field have a magic get and setter method so if a field like "text" exists, getText and SetText will automatically alter it.

2. Or Do i just simply dump the CSV to Arrays and just pick from them.

Now with the first i'm hoping to do the above

//Getters
$ArrayyCollection->getRow(1)->getField(" item "wink->getValue() ; //Long Method
$ArrayCollection->getRow(1)->item; //Short Hand Magic Method
//Setters
$ArrayCollection->getRow(1)->getField(" item "wink->setValue(" title "wink;
$ArrayCollection->getRow(1)->item="value";



anyway i know there are better coders than me over here so i won't mind some insights on it. thanks a lot, i intend to use this to create a simple class that takes CSV and exports them to MoodleXML for Quizzes.
Re: Trivial Question Csv/arraycollection by Nobody: 5:46pm On Dec 06, 2012
Arggghhh damn smileys
Re: Trivial Question Csv/arraycollection by Nobody: 9:18am On Dec 07, 2012
No PHP5 Developers here undecided ??
Re: Trivial Question Csv/arraycollection by Nobody: 3:06pm On Dec 16, 2012
Hey Guys, just thot i share it not sure if anyone interested, but i used the Code from a git i saw, since it makes no sense writing what someone has already done for people to clone,
https://github.com/kurijov/php-array-collection

Its not the exact thing i needed but it worked anyway.

1 Like

(1) (Reply)

Facebook Has A New Landing Page / SEO360: The Best Search Engine Marketer In Nigeria - SEO/SEM Rating 2013 / How I Got Adsense Approval Without Using Any Third Party

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 8
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.