ShadowByte Posted February 1 Share Posted February 1 Hello everyone, I would like to create a download area where I can, for example. pdf, zip, rar, odt files can be offered for download. Downloads should also be counted if possible. Is there a possibility? Does anyone have an idea for me? Thanks in advance Greetings Link to comment Share on other sites More sharing options...
monollonom Posted February 3 Share Posted February 3 I’ve never tried myself, but I assume you could achieve this using the “PagefileSecure” option in your template holding the files: Which would then allow you to hook into ProcessPageView::sendFile: $wire->addHookAfter("ProcessPageView::sendFile", function(HookEvent $event) { /** @var Page $page */ $page = $event->arguments("page"); if($page->template == 'admin') return; /** @var Pagefile $file */ $file = $page->filesManager()->getFile($event->arguments("basename")); $page->of(false); $count = (int) $file->filedata("downloadsCount"); $file->filedata("downloadsCount", ++$count); $page->save(); }); And then later on retrieve and display the downloads count. 3 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now