PHP-Nuke come with its own Javascript functions included in the file javascript.php, located under the includes folder. You can add your own Javascript code there, if you follow some simple
rules:
Use a decent text editor (see Chapter 11) to edit the file.
Append your code after the code already there, but before the ending ?> line.
"echo" each line of your Javascript script. Example: Instead of entering directly the script code:
Enclose each line in double quotes, like a string, and escape (with a backslash \) any double quote inside that string.
Add a newline character (\n) to the string, before the closing double quote[1].
End each line, like every PHP line, with a semicolon (;).
If you use vi (see Section 11.1), the following sequence of vi commands, applied to a Javascript file, will produce the right PHP code to
append in the javascript.php file:
the "window.open" line in the example above is actually a long line that has been broken to 3 lines only for layout purposes, that's why there are no newlines (\n) at the ends of two lines (just
as there is no semicolon for the same reason).