From ea1ab70148decb7f5015d5c52511cd84ddf0ad17 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 24 Apr 2021 21:00:42 +0000 Subject: Fix bug when second argument is absent, improve documentation Before, the InjectFoot variable wasn't cleared. --- README | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) (limited to 'README') diff --git a/README b/README index a7c716b..0ef8ea4 100644 --- a/README +++ b/README @@ -16,8 +16,9 @@ DESCRIPTION The Inject directive takes one or two arguments, which correspond to the file names of two HTML files in the document root. The contents of these files are then inserted into any requested HTML file. The first file - (the header) is inserted before the body of the requested HTML file, - while the second file (the footer) is inserted after the body. + (the header) is inserted at the top of the body of the requested HTML + file, while the second, optional file (the footer) is inserted at the + bottom of the body. The directive is smart enough to place the header and footer in the proper places. The contents of the header file is inserted after any @@ -26,6 +27,20 @@ DESCRIPTION the source of the requested HTML page). Likewise, the contents of the second file is placed before any potential final . + The Inject directive serves a much more specific purpose than + server-side includes. It is designed for injecting headers and footers + that belong in the element, such as headings, menu bars and + copyright notices. While you can technically include elements in + your header file, they will be placed in the body of the HTML page and + not in the head. + + The main benefit over server-side includes is that the header and footer + is specified in the server configuration instead of the HTML files + themselves. Thus, it is useful for adding headers and footers to a large + number of pre-existing static HTML pages. Furthermore, this means that + the headers and footers on all pages can be changed at once by a single + change in the server configuration. + Please note: * The Inject directive is valid only inside directory sections, such @@ -33,11 +48,9 @@ DESCRIPTION .htaccess files if AllowOverride Limit/AuthConfig/All is enabled. * The file paths given to Inject are relative to the document root of - the current server or virtual server. - - * Apache::Inject is designed for injecting headers and footers that - belong in the element, such as headings, menu bars and - copyright notices. It is not built for inserting elements. + the current server or virtual server -- not the directory to which + the current directory section or .htaccess file applies. They should + be specified without a leading slash. INSTALLATION To install this module type the following: @@ -68,13 +81,18 @@ OPERATION concatenates them intelligently and prints their combined contents. DIAGNOSTICS - Apache::Inject::Handler logs all errors and warnings to the Apache log - file. Below is a list of all issued errors and warnings. + Apache::Inject and Apache::Inject::Handler log all errors and warnings + to the Apache log file. Below is a list of all issued errors and + warnings. Note that whenever Apache::Inject::Handler issues an error or a warning, this means that it also declines the request, letting Apache handle it as it would if the Inject directive were not used. + Error: Argument cannot be a single space + The file names given to Inject are not allowed to by a single space, + as this is a special value signifying absence of an argument. + Error: InjectHead/InjectFoot should not begin with slash, as it is already always relative to document root The paths given to Inject are always relative to the document root, -- cgit v1.2.3