Method showFile()

public function showFile() {
    
    //...your PHP code...//
}

Summary

Allows you to generate a file for download using your module.

Context

No context is provided automatically. You must provide any context yourself in the GET request.

Where You Can Use It

From Zenario 7.0.0 onwards.

Description

You should write a showFile() method if you want your Plugin to generate files.

You should send appropriate headers, then output the contents of the file.

Return Value

No return value is needed.

Example

public function showRSS() {
    header('Content-Type: text/plain');
    header('Content-Disposition: attachment; filename="mytextfile.txt"');
    readfile("mytextfile.txt");
}

This offers a file called mytextfile.txt for download. (Note that this is just a simple example; you would probably want to store files in a database table to make showFile useful.