A plain text file needs a somewhat different treatment than a HTML file, if it is to be included in a PHP-Nuke module. The reason is that a plain text file lacks
the formatting tags that are present in a usual HTML file. If you simply include it as shown in Section 21.5, it will show as a single paragraph,
lacking any structure.
Why? Because the "formatting tags" of a plain text file are the newline characters. They will introduce a new line - and a new paragraph. In HTML however, a newline will not suffice, you need a
break tag (<br>) to achieve the same effect. Since a PHP-Nuke module is a PHP file, and as such it will be transformed to a
HTML file for the visitor, we need to play by the HTML rules if we want our file to be formatted correctly.
Fortunately, the nl2br PHP function (newline to break) comes to our rescue here: it
will automatically insert HTML <br /> tags (breaks) before every newline in the text file. Replace
include("path/to/the/html/file"); // <-- CHANGE THIS!
in the code of Section 21.5 with (see another adding module
$filename = "path/to/the/text/file"; // <-- CHANGE THIS!
$content_array = file($filename);
$content = implode("", $content_array);