bibb-theme/templates/RecordDriver/SolrMarc/data-series.phtml

36 lines
1.3 KiB
PHTML
Executable File

<?php foreach ($data as $field): ?>
<?/* Depending on the record driver, $field may either be an array with
"name" and "number" keys or a flat string containing only the series
name. We should account for both cases to maximize compatibility. */?>
<?php //print_r($field); ?>
<?php if (is_array($field)): ?>
<?php if (!empty($field['name'])): ?>
<?php $link = $field['name'];
$l = strrpos($link, ';');
if ($l !== false) $link = trim(substr($link,0,$l));
?>
<a href="<?=$this->record($this->driver)->getLink('series', $link)?>"><?=$this->escapeHtml($link)?></a>
<?php if (!empty($field['number'])): ?>
<?php echo "; " .$this->escapeHtml($field['number'])?>
<?php endif; ?>
<br/>
<?php endif; ?>
<?php if (!empty($field[0])): ?>
<?php $link = $field[0] ;
$l = strrpos($link, ';');
if ($l !== false) $link = trim(substr($link,0,$l));
?>
<a href="<?=$this->record($this->driver)->getLink('series', $link)?>"><?=$this->escapeHtml($link)?></a>
<?php if (!empty($field['number'])): ?>
<?=$this->escapeHtml($field['number'])?>
<?php endif; ?>
<br/>
<?php endif; ?>
<?php else: ?>
<a href="<?=$this->record($this->driver)->getLink('series', $field)?>"><?=$this->escapeHtml($field)?></a><br/>
<?php endif; ?>
<?php endforeach; ?>