Author Topic

Thomas Nunninger

Sunday 18 June 2006 5:41:00 am

Comment44898

Another thing: I can't see the sense of the $i counter. If you import many data you will fill your memory because all the XML data of all the just saved objects is still available. Just replace

foreach ($paths_item as $path_item) {
    foreach($fieldNameList as $fieldName) {
        $fieldValue = $xPathEngine->wholeText("$path_item/$fieldName"."[1]");
        $parsedItems[$i][$fieldName]=$fieldValue;
        if ($fieldName=='account-login') $isAcountObject=true;
    }

with

foreach ($paths_item as $path_item) {
    $parsedItems = array();  // resets the parsed data 
    foreach($fieldNameList as $fieldName) {
        $fieldValue = $xPathEngine->wholeText("$path_item/$fieldName"."[1]");
        $parsedItems[$fieldName]=$fieldValue; // delete the [$i] everywhere
        if ($fieldName=='account-login') $isAcountObject=true;
    }

Have a nice day and of course: thanks for the extension - saves much work :-)

Thomas

Edit: Sorry, I didn't read the next lines:

$result['data']= $parsedItems;

But I don't know if you really want that feature in a mass import situation...