function Record::ffield in Bibliography Module 7.2
Same name and namespace in other branches
- 6.2 modules/marcParse/php-marc.php \Record::ffield()
- 6 marcParse/php-marc.php \Record::ffield()
- 7 modules/marcParse/php-marc.php \Record::ffield()
Formatted representation of Field
Format a Field with a sprintf()-like formatting syntax. The formatting codes are the names of the subfields of the Field.
Parameters
string Field name:
string Format string:
Return value
string|FALSE Return formatted string if Field exists, otherwise False
File
- modules/
marcParse/ php-marc.php, line 607
Class
- Record
- Record Class Create a MARC Record class
Code
function ffield($tag, $format) {
$result = "";
if ($field = $this
->field($tag)) {
for ($i = 0; $i < strlen($format); $i++) {
$curr = $format[$i];
if ($curr != "%") {
$result[] = $curr;
}
else {
$i++;
$curr = $format[$i];
if ($curr == "%") {
$result[] = $curr;
}
else {
$result[] = $field
->subfield($curr);
}
}
}
return implode("", $result);
}
else {
return FALSE;
}
}