Da immer wieder die Frage aufkommt, hier die Anleitung wie man in die Newsliste ein Thumbnail mit ausgeben kann, das immer die gleiche fixe Größe hat.
Ich habe dazu in der news_short.tpl folgendes nach der Überschrift eingefügt:
(Script-Schnipsel für die fixe Größe stammt aus diesem Post von QCO)
PHP-Code:
<!-- Thumbnail mit fixer Groesse -->
<?php
$width = 60;
$height = 60;
$this->src = $this->getImage($this->urlEncode($this->singleSRC), $width, $height);
if (($imgSize = @getimagesize(TL_ROOT . '/' . $this->src)) !== false)
{
$this->imgSize = ' ' . $imgSize[3];
}
?>
<?php if ($this->addImage): ?>
<div class="image_container" style="padding-right: 10px; float: left;">
<?php if ($this->fullsize): ?><a href="<?php echo $this->href; ?>" title="<?php echo $this->alt; ?>" rel="lightbox"><?php endif; ?>
<img src="<?php echo $this->src; ?>"<?php echo $this->imgSize; ?> alt="<?php echo $this->alt; ?>" /><?php if ($this->fullsize): ?></a><?php endif; ?>
<?php if ($this->caption): ?>
<div class="caption"><?php echo $this->caption; ?></div>
<?php endif; ?>
</div>
<?php endif; ?>
<!-- Ende Thumbnail -->
Natürlich wird das Thumbnail nur angezeigt, wenn im jeweiligen Nachrichtenbeitrag sauber mit der "Bild hinzufügen"-Funktion ein Bild eingefügt wurde.
Das ganze Template news_short.tpl sieht dann z. B. so aus:
PHP-Code:
<div class="layout_short block<?php echo $this->class; ?>">
<?php if ($this->hasMetaFields): ?>
<p class="info"><?php echo $this->date; ?> <?php echo $this->author; ?> <?php echo $this->commentCount; ?></p>
<?php endif; ?>
<h2><?php echo $this->linkHeadline; ?></h2>
<!-- Thumbnail mit fixer Groesse -->
<?php
$width = 60;
$height = 60;
$this->src = $this->getImage($this->urlEncode($this->singleSRC), $width, $height);
if (($imgSize = @getimagesize(TL_ROOT . '/' . $this->src)) !== false)
{
$this->imgSize = ' ' . $imgSize[3];
}
?>
<?php if ($this->addImage): ?>
<div class="image_container" style="padding-right: 10px; float: left;">
<?php if ($this->fullsize): ?><a href="<?php echo $this->href; ?>" title="<?php echo $this->alt; ?>" rel="lightbox"><?php endif; ?>
<img src="<?php echo $this->src; ?>"<?php echo $this->imgSize; ?> alt="<?php echo $this->alt; ?>" /><?php if ($this->fullsize): ?></a><?php endif; ?>
<?php if ($this->caption): ?>
<div class="caption"><?php echo $this->caption; ?></div>
<?php endif; ?>
</div>
<?php endif; ?>
<!-- Ende Thumbnail -->
<p class="teaser"><?php echo $this->teaser; ?></p>
<?php if ($this->text): ?>
<p class="more"><?php echo $this->more; ?></p>
<?php endif; ?>
</div>
Lesezeichen