Module

Download-Statistics Erweiterung

Das Modul "Download Statistics" (dlstats) zählt die Downloads und stellt eine Statistik im Backend bereit. Zur Zeit gibt es noch keine Möglichkeit damit auch eine Frontend Ausgabe zu bekommen. Bis dahin (Entwicklung läuft) gibt es die Variante mit Contao Mitteln dieses zu tun (für Einzel-Download) und das sieht dann so aus:

download-stat-add-on

Dazu nutzt man das Modul "Auflistung" und gibt dazu an:

  • Tabelle: tl_dlstats
  • Felder: downloads
  • Bedingung: filename='tl_files/datei.zip'

Das Listen Template "list_default" zeigt mehr an als ich benötigte. Daher kopierte ich es in das Verzeichnis /template als "list_dlstats" und kürzte es auf das Notwendigste, ein class Name und ein Text wurde noch eingefügt.(dieses neue Template dann im Listing Modul nutzen)

Im Artikel wird das direkt nach dem (Einzel) Download Element ein Artikel Element vom Typ Modul angelegt und dort das vorher importierte Modul Auflistung gewählt.

Hier das Template und die dazu passende CSS Datei als Anregung.

 

<div class="<?php echo $this->class; ?>"<?php echo $this->cssID; ?>
<?php if ($this->style): ?> style="<?php echo $this->style; ?>"<?php endif; ?>>
<?php if ($this->headline): ?>
<<?php echo $this->hl; ?>><?php echo $this->headline; ?></<?php echo $this->hl; ?>>
<?php endif; ?>
	<?php foreach ($this->tbody as $class=>$row): ?>
	<?php foreach ($row as $col): ?>
	    <div class="dlstatscounter <?php echo $col['class']; ?>">Downloads: <?php echo $col['content']; ?></div>
	<?php endforeach; ?>
	<?php endforeach; ?>
</div>
.dlstatscounter {
  margin:-10px 0px 10px 22px;
}