mod_macro.html.en revision 5f42e12f1d9b59e2b18e7a7d55184d30dca8b067
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin This file is generated from xml source: DO NOT EDIT
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="/style/css/prettify.css" />
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin<script src="/style/scripts/prettify.js" type="text/javascript">
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin<link href="/images/favicon.ico" rel="shortcut icon" /></head>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin<div class="up"><a href="./"><img title="<-" alt="<-" src="/images/left.gif" /></a></div>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.5</a> > <a href="./">Modules</a></div>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin<p><span>Available Languages: </span><a href="/en/mod/mod_macro.html" title="English"> en </a> |
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin<a href="/fr/mod/mod_macro.html" hreflang="fr" rel="alternate" title="Fran�ais"> fr </a></p>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Provides macros within apache httpd runtime configuration files</td></tr>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin<tr><th><a href="module-dict.html#Status">Status:</a></th><td>Base</td></tr>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin<tr><th><a href="module-dict.html#ModuleIdentifier">Module�Identifier:</a></th><td>macro_module</td></tr>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin<tr><th><a href="module-dict.html#SourceFile">Source�File:</a></th><td>mod_macro.c</td></tr></table>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin <p>This modules provides macros within apache httpd runtime configuration files.
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin These macros may have parameters. They are expanded when used (parameters are
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin substituted by their values given as an argument), and the result is
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin processed normally.</p>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin<div id="quickview"><h3 class="directives">Directives</h3>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin<li><img alt="" src="/images/down.gif" /> <a href="#macro"><Macro></a></li>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin<li><img alt="" src="/images/down.gif" /> <a href="#undefmacro">UndefMacro</a></li>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin<li><img alt="" src="/images/down.gif" /> <a href="#use">Use</a></li>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin<li><img alt="" src="/images/down.gif" /> <a href="#features">Features</a></li>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin<li><img alt="" src="/images/down.gif" /> <a href="#examples">Examples</a></li>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin</ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin<h2><a name="features" id="features">Features</a></h2>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin <li> macro definition within a <code class="directive"><Macro></code> section, following
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin the httpd configuration style.</li>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin <li> user defined names for the macro and its parameters.</li>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin <li> macro names are case-insensitive, like httpd directives.</li>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin <li> macro parameters must have distinct names.</li>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin <li> macro definitions can be nested... (but what for?)</li>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin <li> warn about macro parameter names which prefix one another.</li>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin <li> warn if a parameter is not prefixed by any of '<code>$%@</code>'
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin (good practice).</li>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin <li> the available prefixes help deal with interactions with other
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin directives such as <code class="directive"><a href="/mod/core.html#define">Define</a></code>.</li>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin <li> tip: it may be useful to define a macro parameter with surrounding
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin braces, say <code>${foo}</code> so that the name can appear with
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin surrounding characters such as <code>bla${foo}bla</code>.</li>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin <li> warns if sections are not properly nested within a macro.
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin (if it is detected so).</li>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin <li> the lexical scope of macro parameters is restricted to the macro text,
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin it is not forwarded to includes for instance.</li>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin <li> arbitrary contents in macros.
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin <p>It means you can put perl sections or whatever you like in a macro.
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin No assumption is made about the lexical structure (quotes, spaces or
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin whatever) within the macro contents but to expect a set of
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin <li> number of arguments must match the definition.</li>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin <li> all occurences of macro parameters are substituted by their values.</li>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin <li> in case of conflicts, the longest parameter name is chosen.</li>
4a3b6b890a52931991a7ed042d5973ef2039c623minfrin <li> macro expansion recursion is detected and stopped (error).</li>
<p>A common usage of <code class="module"><a href="/mod/mod_macro.html">mod_macro</a></code> is for the creation of
<div class="directive-section"><h2><a name="Macro" id="Macro"><Macro></a> <a name="macro" id="macro">Directive</a></h2>
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Define a configuration file macro</td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
<div class="directive-section"><h2><a name="UndefMacro" id="UndefMacro">UndefMacro</a> <a name="undefmacro" id="undefmacro">Directive</a></h2>
<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Undefine a macro</td></tr>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>UndefMacro <var>name</var></code></td></tr>
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
<div class="directive-section"><h2><a name="Use" id="Use">Use</a> <a name="use" id="use">Directive</a></h2>
<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Use <var>name</var> [<var>value1</var> ... <var>valueN</var>]
<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
<p><span>Available Languages: </span><a href="/en/mod/mod_macro.html" title="English"> en </a> |
<a href="/fr/mod/mod_macro.html" hreflang="fr" rel="alternate" title="Fran�ais"> fr </a></p>
</div><div class="top"><a href="#page-header"><img src="/images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
var comments_identifier = 'http://httpd.apache.org/docs/trunk/mod/mod_macro.html';
if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
d.write('<div id="comments_thread"><\/div>');
var s = d.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
(d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
<p class="apache">Copyright 2013 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--