wiki_anleitung:besucherzaehler
Dies ist eine alte Version des Dokuments!
1. create a directory _views in datadir (usually data) and copy your old visits file in there
2. create the file inc/counter.php
<?php global $ID,$ACT; $file=realpath($conf['datadir']).'/_views/'.$ID; if (file_exists($file)) { $views=FALSE; while ($views===FALSE) { $views=file_get_contents($file); if ($views===FALSE) { usleep(50000); } } $views=$views+1; } else { $views=1; } if (($ACT == 'show') && ($INFO['exists'])) { while(!$written) { $written=file_put_contents($file,$views); if (!$written) { usleep(50000); } } } $fn.=" ($views views) ";
3. add include('counter.php'); in inc/template.php as below
function tpl_pageinfo(){ global $conf; global $lang; global $INFO; global $REV; // prepare date and path $fn = $INFO['filepath']; if(!$conf['fullpath']){ if($REV){ $fn = str_replace(realpath($conf['olddir']).DIRECTORY_SEPARATOR,'',$fn); }else{ $fn = str_replace(realpath($conf['datadir']).DIRECTORY_SEPARATOR,'',$fn); } } $fn = utf8_decodeFN($fn); $date = date($conf['dformat'],$INFO['lastmod']); include('counter.php');
wiki_anleitung/besucherzaehler.1571065400.txt.gz · Zuletzt geändert: 14/10/2019 16:03 (Externe Bearbeitung)
