Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
low_if_referer
Another spin-off from a project: I bring to you a conditional tag that is based on your viewer’s HTTP referer.
Original intention was to display a message to viewers who clicked through from a particular site.
Get it here.
You currently get two attributes for this plugin: uri
and host
.
uri
should be filled with the addresses you’d like for the condition to be checked against. You can enter more than one address; just separate them with spaces.
host
, if set to 1
, sets the plugin to check only the hostname of the referer. Please see the documentation in the plugin for more info.
I suppose the plugin can easily be tweaked to reverse it’s logic, i.e. condition is true if referer is anything but a listed address. I don’t need to do this at this point, so I didn’t write it in. Still, if anyone wants to write that bit in, be my guest.
Justin
Offline
Re: low_if_referer
Oh, I can see a some real potential use for this. However, when you say “see the documentation,” where exactly would I see it?
TextPattern user since 04/04/04
Offline
Re: low_if_referer
Reid, you can see it in the plugins screen, once you install a plugin.
I’ll just paste that bit here.
Usage
Provides one tag:<txp:low_if_referer>...</txp:low_if_referer>
uri
— The referer(s) that validate the condition. Separate multiple referers by spaces.host
—1
or0
. If1
, the referer need only match the host name + trailing slash.
Example, if you want to match http://www.yourdomain.com/something/somethingelse/
exactly, you’d use <txp:low_if_referer uri="http://www.yourdomain.com/something/somethingelse/">...</txp:low_if_referer>
.
Whereas, if you just want to match the hostname, http://www.yourdomain.com/
, you’d use <txp:low_if_referer uri="http://www.yourdomain.com/" host="1">...</txp:low_if_referer>
.
Note that http://www.yourdomain.com/
is not the same as http://yourdomain.com
.
Last edited by JustinLow (2004-12-20 15:10:08)
Justin
Offline
Re: low_if_referer
Just a quick example to illustrate my point.
Let’s say your referer is http://mydomain.com/journal/221/title
.
First case, you want visitors from the above domain to get a welcome message when they visit your site. You’d set host="1"
, and uri="http://mydomain.com/"
.
Okay, second case: you want users who came to your site via that specific article to get a message, but not users who came via other articles. In this case, you’d set uri="http://mydomain.com/journal/221/title"
. You don’t have to declare a value for host
.
In the second case, the trailing slash makes a difference. In both cases, as stated above, http://www.yourdomain.com/
is not the same as http://yourdomain.com/
.
Hope this helps.
Justin
Offline
Re: low_if_referer
Thanks for the examples, and the plugin. But in TxP 1.19, when I installed the plug-in, I couldn’t find any documentation, just the code for the plugin (I really do try to RTFM before asking…)
Am I looking in the wrong spot?
TextPattern user since 04/04/04
Offline
Re: low_if_referer
That’s pretty odd. With my g1.19 install, I can see both code and documentation. I just installed it by loading the text file. Once I click onto the plugin to see the code, the instructions are below the ‘save’ button.
Here’s a screenshot.
By the way, it hasn’t been tested with g1.19 as I’m using 1.0rc1 for the project. If you find any problems with it, please let me know. Thanks!
Last edited by JustinLow (2004-12-20 17:51:53)
Justin
Offline
Re: low_if_referer
Dumbo was looking in the text box for commented out lines. Dumbo needed to scroll. My apologies.
TextPattern user since 04/04/04
Offline
Pages: 1