LoadModule sqltemplate_module modules/mod_sqltemplate.so # These commands MUST appear before any template sections, to initialise the # database connection: # DBD driver to use SQLTemplateDBDriver "mysql" # DBD driver parameters SQLTemplateDBParams "host=localhost,user=db-username-here,pass=password-goes-here,dbname=database-name" # There are three new sections: , and # SQLRepeat sections repeat their content for every result row, replacing # variables with column values as necessary. NULL values expand to the empty # string. The sections take the form: # # ... # # # Note that, in all cases, variable names are taken from the column names # returned by the query. # # variables can be "bare" (i.e. no braces) and the longest match (no # spaces) wins ServerName $foo.base.example.org # or they can be enclosed in braces to force an exact match Header Add "X-Your-Base" "${foo}" # Note that in this example, $barrister would substitute the same way # as ${bar}rister Header Add "X-Are-Belong" "$barrister" Header Add "X-To-Us" "${quux}" # Repeat sections can be nested... but escape the variables unless you # want warnings or want them replaced by the outside section. This ${id} # comes from the outer section: # but these come from the inner Alias "\$base" "\$target" # If you had a third-level nesting, you would need two backslashes # SQLCatSet sections concatenate all of the results for each field of the # query into one string, separated by a given delimiter string. It takes # the form: # # ... # # # The example below will take all results of the query (e.g. "*.base", # "*.base.org", "*.base.example.com") and concatenate them with a space to # form: "*.base *.base.org *.base.example.com" # ServerAlias ${hostname} # Finally, SQLSimpleIf provides a very simple conditional inclusion test. # If the first character of its argument is an exclamation mark, it is # negated. Otherwise, the content is included if the argument is a non-zero # integer, "on", "true" or "yes". Header Add "X-Quux" "Included" Header Add "X-Quux" "Not included" # vim: ft=apache sw=2 ts=2 et