Search Results

Search found 3 results on 1 pages for 'whykiki'.

Page 1/1 | 1 

  • PHP: csv generator creates extra field

    - by WhyKiki
    I'm coding a script that takes one csv file to transform it into another one. Basically, two foreach loops are used: one to iterate records and another to iterate fields. Certain fields (cno 25, 26, 44) for each record needs to be modified. The problem is that each modificatino creates an extra empty field, i.e. the code $colStr .= '"' . $col . '";'; works but not any of the code in the if statements. The code is: $rno = 0; foreach ($csvArray as $line) { $cno = 0; $colStr = ""; foreach ($line as $col) { if($rno>0 && $cno==25) { $stuff = array($csvArray[$rno][41], $csvArray[$rno][47], $csvArray[$rno][48], $csvArray[$rno][49]); foreach($stuff as &$value) { $value = preg_replace('/[^0-9]/', '', $value); } sort($stuff, SORT_NUMERIC); // Causes bug! $colStr .= '"' . $stuff[0] . '";'; } if($rno>0 && $cno==26) { $urls = ""; for($i = 55; $i<=62; $i++) { $urls .= "Images: " . $csvArray[$rno][$i] . " | "; } $urls .= "Some text: " . $csvArray[$rno][43] . " | "; // Causes bug! $colStr .= '"' . $urls . '";'; } if($rno>0 && $cno==44) { $colStr .= '"' . $_POST['location'][$rno] . '";'; } if($rno>0 && $cno==54) { $objType = $col; $objType = preg_replace('/foobar/i', '123', $objType); // Causes bug! $colStr .= '"' . $objType . '";'; } else { // This is ok, though $colStr .= '"' . $col . '";'; } $cno++; } $colStr = preg_replace('/;$/', '', $colStr); $colStr .= "\n"; fwrite($outputFile, $colStr); $rno++; } fclose($outputFile);

    Read the article

  • Drupal print module: controlling layout in PDF files?

    - by WhyKiki
    So I'm trying to fix the layout of the PDF files for a specific content type. I'm messing around in the tpl.php file and can't find a way to modify individual fields. There's just the massive $print['content'] variable that contains all of the page content. So, is there a way to access each field?

    Read the article

  • A scripting langauge for Windows?

    - by WhyKiki
    I work in Windows and often find the need to code some script that manipulates files or basic string manipulation. Currently, I'm doing this using PHP but having a LAMP stack for this seems overkill. I've tried things like autoHotkey but the syntax and functionality is horrific. So I'm looking for a scripting with: a) a sane syntax b) lots and lots of built-in libraries, functions, etc c) minimal setup. Preferably, I would like to code and run the script from my app launcher of choice, Executor

    Read the article

1