Content last modified Saturday 21 March 2020
hop to #bottom
Current version:
About It:
Get it:
Rate it:
  • Helpful?
  • 1 Yes
  • 0 No
Flag it:

If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!


This little plugin is meant to help those who do Textpattern development on localhost or a subdomain. Sometimes you’ll want to do one thing on the in-development site, and another on the “live” site. The conditional tag provided by aam_if_host lets you do exactly that.

NOTE: requires Txp 4.0.4 or newer.


Let’s say you’re using some complex JavaScript on your site. On the public site you want to serve a script that’s been packed, but while you’re developing the site you want to keep the scripts readable for debugging. Here’s how:

<txp:aam_if_host name="localhost,">
  <script type="text/javascript" src="<txp:site_url />js/myscript.js"></script>
<txp:else />
  <script type="text/javascript" src="<txp:site_url />js/myscript.packed.js"></script>

The name attribute takes a comma-separated list of server names. The default value for name is “localhost”.

As with the built-in conditional tags, you can use <txp:else /> to specify what happens if the condition is false (e.g. the site is on instead of localhost or


Copyright © 2007 Adam Messinger.

Distributed under the terms of the BSD license.

Article Request Count:
Initially released:
Posted here:
18 Dec 2007

You know you want to visit the Archives.
Published with Textpattern