Vorlage:Legende: Unterschied zwischen den Versionen

Aus Afterbuy-Wiki
Wechseln zu:Navigation, Suche
Zeile 11: Zeile 11:
 
$description=trim($argv['description']);
 
$description=trim($argv['description']);
 
}
 
}
 +
 
if(isset($argv[0]) && trim($argv[0])!=""){
 
if(isset($argv[0]) && trim($argv[0])!=""){
echo '<tr><th>'.$name.'</th><th>'.$description.'</th></tr>';
+
 +
$errorMessages=array('');
 +
$out=array( '<tr><th>'.$name.'</th><th>'.$description.'</th></tr>');
 
$lines=explode('>>',$argv[0]);
 
$lines=explode('>>',$argv[0]);
 +
$row=1;
 +
 
foreach($lines as $line){
 
foreach($lines as $line){
 
  if(trim($line)!=""){
 
  if(trim($line)!=""){
 
  $cells=explode('::',trim($line));
 
  $cells=explode('::',trim($line));
  echo '<tr><td class="font-weight-bold" style="width:33%;" align="left">'.trim($cells[0]).'</td><td>'.trim($cells[1]).'</td></tr>';
+
  $fieldName="";
 +
  if(isset($cells[0]) && trim($cells[0])!=""){
 +
  $fieldname=trim($cells[0]);
 +
  } else {
 +
  $errorMessages[]="Feld Name in Zeile ".$row." nicht gesetzt";
 +
  }
 +
  $fieldDescription="";
 +
  if(isset($cells[1]) && trim($cells[1])!=""){
 +
  $fieldDescription=trim($cells[1]);
 +
  } else {
 +
  $errorMessages[]="Feld Beschreibung in Zeile ".$row." nicht gesetzt";
 +
  }
 +
  $out[]='<tr><td class="font-weight-bold" style="width:33%;" align="left">'.$fieldName.'</td><td>'.$fieldDescription.'</td></tr>';
 
  }
 
  }
 +
  $row++;
 
}
 
}
 +
 +
if(isset($errorMessages) && is_array($errorMessages) && !empty($errorMessages)){
 +
echo 'Legende-Fehler:'.implode('',$errorMessages);
 +
}
 +
 +
if(isset($out) && is_array($out) && !empty($out)){
 +
echo implode('',$out);
 +
}
 +
 
}
 
}
 +
 
}
 
}
 
</phptag>
 
</phptag>
 
</table>
 
</table>

Version vom 23. April 2021, 12:53 Uhr