sitting here for hours, but i can't see what the problem is.
I've got 1 file: Gross_matching.csv:
Actionspiele,77
Strategiespiele,112
And the keywords are "Actionspiele, Strategiespiele".
And would like to get this file, and search after "Actionspiele" and would like to get "77|112". But I'm getting "77|77". Does anybody know why?
<?php
if (!empty($articleData['keywords'])) {
$temp_dir = "...";
if (file_exists($temp_dir."gross_matching.csv")) {
$csv = array();
$file_gross = fopen($temp_dir."gross_matching.csv", 'r');
while (($result = fgetcsv($file_gross, ",")) !== false) {
$csv[] = $result;
}
fclose($file);
} else {
$articleData['attr_attr18'] .= " | File not found";
}
if (!empty($csv)) {
$string = '';
$keywords = explode(",", $articleData['keywords']);
if(is_array($keywords)) {
foreach($keywords as $key => $value) {
$pos = array_search($value, $csv);
$string .= $csv[$pos][1]."|";
}
if (!empty($string)) {
$articleData['attr_attr18'] = $string;
} else {
$articleData['attr_attr18'] .= " - String empty";
}
}
} else {
$articleData['attr_attr18'] .= " - csv empty";
}
} else {
$articleData['attr_attr18'] .= " - not Gross";
}
?>