The outputfile class manages files for outputting content. This includes both appending to an existing file, and creating new files. The method used in both cases is to write to a temporary file, and then rename/move it onto the final file path when closefile() is called.
Located in /file-defs.php (line 440)
Class | Description |
---|---|
![]() |
This is a derived class from outputfile and is a quick way of creating a file with content in a single hit. You can check the $created property afterwards to determine success/failure. |
The full path to the file
The directory prefix (if any) of the file
Type of file 'text' or 'templated'
File pointer
The file name
True if file was sucessfully opened
How to save: default "overwrite", or "append" to append.
Full pathname of destination (temporary) file
Content of template file when read in
Full pathname of template file
File pointer
Constructor
Note that we open a temporary file, write to this file, and only move it to the destination when closed. This means it is less prone to interferring with external processes which might be accessing it when in the process of being built.
Close the file. We move the temporary file that has been built to
the actual file path contained in 'datafname'. If this is called with no argument, then the default mode SAVE_MODE is assumed and the file is saved. However if the argument is set to the constant ABANDON_FILE then nothing will be saved/created.
Replace a pattern in the current $this->content with replacement string. This allows us to work on a template, replacing bits of it that represent our dynamic content.
This defines a template for the file content and flags the file as being of "templated" type. The template is expected to be at the $path specified. The template is opened and the entire file contents are put into $this->content.
Set the file type. Possible types include 'text' (default), 'html', and 'templated'.
Write to file Write the given string to the output file.
Write line to file Write the given string to the output file as a line.
Documentation generated by phpDocumentor 1.3.0RC3