SourceViewer
SourceViewer is a php script and tool that allows you to provide an easy way for
your visitors to view the source of your website. For example, the "view source"
link at the bottom of this website takes you to the SourceViewer highlighting
he current page.
The basic SourceViewer is designed especially for displaying the source of
websites. Here are some of the key features present in SourceViewer:
-
Allows highlighting of files in the directory where sourceviewer is located
and any subdirectories. Limiting sourceviewer only to a few files is very
simple, since SourceViewer makes absolutely certain that it only accesses
files in it's own and subdirectories.
-
SourceViewer can also be restricted to only certain file extensions. This way
you can only allow access to for example .php files, but prevent access from
.php4 files or something similiar. It is also possible to define regular
expressions, which the path is matched against to make sure it doesn't access
those paths.
-
SourceViewer supports multiple different styles, and making your own style only
requires some PHP skill (or alternatively editing the styles for the custom
style). By default, SourceViewer comes with 2 customized styles, php default
style and plain style (i.e. no styling).
-
Source can be viewed with line numbers or without line numbers. Line numbers
are achieved by <ol> list, instead of plain written numbers, making
copying the source much easier.
-
SourceViewer also provides slightly alternative style sheet for printing. This
stylesheet makes lines wrap and also removes the excess coloring from line
number colum and header & footer. The style of the code itself however is
left intact.
In addition to being designed for viewing the source of website, it can also
be used for highlighting php code on website using the highlighting classes.
One interesting feature that you can find in the highlighting classes is that
the output is returned in array, where each index is one line separately
formatted. This allows you to easily format the code into lines as you want
yourself. With a bit of PHP knowledge and reading the provided documentation,
you may also write your own highlighting styles for the highlight classes.
For examples, simply click the "View Source" link on the bottom of this page.