If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!
aam_if_host
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.
Usage
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,dev.example.com">
<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>
</txp:aam_if_host>
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 www.example.com
instead of localhost
or dev.example.com
).
License
Copyright © 2007 Adam Messinger.
Distributed under the terms of the BSD license.