Listentemplate: Datensätze einschränken
Hallo,
ich möchte auf der linken Seite die neuesten Kommentare anzeigen und bin nun so weit, dass ich die Kommentare in der Darstellung habe, so wie ich es möchte. Nun geht es um das Einschränken der Kommentare.
Nur die - z.B. 3 - neuesten Kommentare sollen in die Liste. Ich habe gesehen, dass es im Backend-Modul ein "Bedingung"-Feld gibt. Aber dort kann ich meine Bedingung wahrscheinlich nicht unterbringen (wäre so was wie "Top 3" nach dem SQL Select).
Im Listentemplate über PHP zu filtern würde ich gerne vermeiden, da umständlich und imperformant.
Weiß jemand Rat?
Gruß!
Torsten
Hat geholfen. Und ich habe mich sehr darüber gefreut,...
... aber er filtert im Template. Das will ich nicht (siehe Post).
Mein Template sieht aktuell übrigens so aus:
PHP-Code:
<div class="<?= $this->class ?> comments_last listing block"<?= $this->cssID ?><?php if ($this->style): ?> style="<?= $this->style ?>"<?php endif; ?>>
<?php if ($this->headline): ?>
<<?= $this->hl ?>><?= $this->headline ?></<?= $this->hl ?>>
<?php endif; ?>
<?php foreach ($this->tbody as $key=>$value): ?>
<?php if($value['published']['content'] == 1): ?>
<?php
/* show only first 100 characters of comment wihthout enclosing <p></p> */
$commentShort = str_replace("</p>","",str_replace("<p>","",substr($value['comment']['content'], 0, 100)));
if (strlen($commentShort) > 10)
{
$commentShort = $commentShort . "...";
}
?>
<p class="article">Zu: <a href="{{news_url::<?php echo $value['parent']['raw']; ?>}}">{{news_title::<?php echo $value['parent']['raw']; ?>}}</a></p>
<p class="comment">"<?= $commentShort ?>"</p>
<p class="author"><?= $value['name']['content'];?>, <?php echo $this->parseDate("d.m H:i", $value['date']['raw']);?></p>
<?php endif; ?>
<?php endforeach; ?>
</div>
Gruß!
P.S.: Wenn nichts hilft, bräuchte ich wohl sowas (ist leider noch nicht verfügbar): https://www.fast-end-media.de/produk...ual-templates/