Content last modified Monday 6 March 2017
hop to #bottom
Categories:
Author:
Current version:
0.10
About It:
Get it:
Rate it:
  • Helpful?
  • 0 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!

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.

Article Request Count:
Keywords/tags:
Initially released:
12/18/2007
Posted here:
18 Dec 2007
Article modified:
19 Dec 2007

If there is a comment form at the Information URL, you may want to leave your comments/questions there or at the Forum thread for quicker feedback. Otherwise, comment away:

Your comment will NOT be submitted until you click the 'Submit' button on the next pageload.

Subscribe to this article's comments RSS feed. [ ? ]   View Recent Comments across the site.

You know you want to visit the Archives.

Browse

Categories


Articles

There are also tag clouds, 'cause those are fun.
Published with Textpattern