Downloadzaehler im catalog

Aus Contao Community Documentation


Manchmal ist es sinnvoll/gewünscht, Dateien mit dem Catalog zum Download anzubieten. Hierbei ist es jedoch nicht möglich, Downloads zu zählen. Dies kann jedoch durch eine einfache Templateanpassung durchgeführt werden.

<?php if (count($this->entries)): ?>
 
	<div class="layout_full">
 
	<?php foreach ($this->entries as $entry): ?>
...
		<?php if($entry['data']['file']['value']): ?>		
			<div class="field file">		
				<?php if ($this->Input->post("file")): ?>
					<?php $this->SendFileToBrowser($this->Input->post("file")); ?>
				<?php else: ?>			
					<form action="<?php echo $this->Environment->request; ?>" method="post">
					<input type="hidden" name="file" value="<?php echo $entry['data']['file']['raw']; ?>">
					<input type="submit" name="save" id="save" class="tl_submit" accesskey="s" value="Download" />
					</form>			
				<?php endif; ?>			
		</div>
		<?php endif; ?>
 
 
 
.....


Somit können mit vorhandenen Tools (zum Beispiel mit der Erweiterung dlstats) die Anzahl der Downloads gezählt werden.

Ansichten
Meine Werkzeuge

Contao Community Documentation

Pelle: gibt's ein besseres Wort für "beschränkt"?
Thomas: "Kunde"

Navigation
Verstehen
Verwenden
Entwickeln
Verschiedenes
Werkzeuge