Post-processing of variables contained within a variable.
Doesn’t sound too helpful ? Well, maybe not, but I found that during construction of this site that I was frequently replicating 5 lines of text with only a single word altered (the left menu). This was both inefficient and awkward to debug, and didn’t lend itself to keeping a common look and feel for the site as a whole. This extension allows large blocks of text to be stored as a variable, and for the small changable part to be altered just before the result is displayed.
When a variable is used in the value entry of a set command the system searches for the current value of the variable and substitutes it immediately. This fixes the value of the variable created so that it never changes, which is good for some applications, but lousy for dynamic content.
<!--#define var="FONT_FACE" value="<FONT FACE="Times">$TEXT</FONT>" --> <!--#macro var="TEXT" value="Hello" def="FONT_FACE" -->
<!--#define var="LINK" value="<A HREF="$URI">$TEXT</A>" --> <!--#set var="TEXT" value="Home" --> <!--#macro var="URI" value="http://minimal.cx/" def="LINK" -->
I do have more than just mod_include compiled into Apache, but the difference between the basic version and mine is 5136 bytes in the httpd executable. I don’t think that the time for standard mod_include calls would be adversely effected, as there are only two extra tests for the new words, and performance of those words is not comparable to the old system.
I’m not interested in making things any more difficult than they already are in this area, so this patch is distributed under the Apache Licence.
The element order checking is not robust for #macro.
Just send it to me and I’ll see what I can do to help out. Bear in mind that I’m doing this primarily for myself, so porting to various other versions of Apache is only likely to happen when I need it, but I’m more than happy to help out if required.