Content last modified Monday 6 March 2017
hop to #bottom
Categories:
Author:
Current version:
0.5
About It:
Get it:
Rate it:
  • Helpful?
  • 0 Yes
  • 0 No
Flag it:
Contact Reason [ ? ]

chs_if_urlvar

a plugin that lets you condition parts of the page depending on GET variables transferred with the url.

the plugin has three functions. the first of which, chs_if_urlvar, lets you condition that if GET variable designsated is equal to the value designated, the enclosed text will appear (an example is in the documentation).

another one, chs_urlvar_default, will show the enclosed text only if the variable is not declared in the url, and a third one, chs_urlvar_exists, will show the enclosed text only if the variable is declared.

more info about usage is in the docs.

Article Request Count:
Initially released:
October 1st, 2005
Posted here:
01 Oct 2005

Comments/questions? Leave a message in the form.

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

Commented (10)

I am definitely going to test this and report, it could open lots of possibilities for me ! Thx !
nardo:
good example at this forum thread:
http://forum.textpattern.com/viewtopic.php?pid=81059
I did write an article about the plugin in german. Read it -> here.
drew:
can this also output clean URLs?
Els:
Is there support for this plugin? I noticed that if you use var=”c” the condition is seen as true if the url is /?c=name-of-category, but also if the url is /category/name-of-category.
Really? Strange. It probably means that Textpattern sets $_GET[‘c’] before the plugin code is executed. Nice to know, though.
What a great relief to have this Textpattern plugin. I try to avoid embedding PHP in my page templates and Textpattern forms as much as possibly, so chs_if_url_var makes a nice building block to enforce that principle.

Thanks!

This plugin seems to work in Textpattern’s versions 4.0.7 and 4.0.8 without problems. If someone needs this, I’m hosting this file over here.

hooch:

this plugin opens you up to cross-site vulnerabilities.. specifically:

<txp:chs_urlvar_echo var=“foo”>

http://yoursite/?foo=<script>alert(‘bar’)</script>

Noam Samuel:

OK, this is a fixed version (raw text right now):

http://chigh.org/ifurlvar_fixed.txt

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

Would you care to write a comment?

You know you want to visit the Archives.

Browse

Categories


Articles

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