Textpattern Forum

You are not logged in. Register | Login | Help

#21 2012-04-21 04:51:00

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 5,016
Website

Re: pat_referrers

Hi Patrick

I’m looking at your plugin for a small project and I’m wondering if it will be appropriate to use.

I am trying to find a way to load some particular page content if the referrer comes from a particular page and/or subdomain of my site (so the referrer comes from the same domain).

Something like

... if_referrer list="subdomain.domain.tld, domain.tld/some_page" 
<txp:some_txp_tags>
/if_referrer
...

Can your plugin handle the above?

Last edited by colak (2012-04-21 05:22:46)


Yiannis
——————————
neme.org | neme-imca.org | hblack.net | LABS

Offline

#22 2012-04-21 14:35:10

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,031
Website

Re: pat_referrers

Hi Yiannis.

First: Actually, pat_referrers is a single tag, not a container one. So you can’t. But that’s an idea ;)
Second: The plugin can’t distinguish sub-domains from domain names. I’d thinking on this new feature but it seems that the source code will be more complex. Do you think it’s very important to add that kind of feature?

Offline

#23 2012-04-21 16:30:01

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 5,016
Website

Re: pat_referrers

Pat64 wrote:

First: Actually, pat_referrers is a single tag, not a container one. So you can’t. But that’s an idea ;)
Second: The plugin can’t distinguish sub-domains from domain names. I’d thinking on this new feature but it seems that the source code will be more complex. Do you think it’s very important to add that kind of feature?

Hi Patrick,

Many thanks for your response. It’ll be very selfish of me to say yes as I am needing that kind of functionality now. I’m not asking you to do it unless others feel that they can use it too.


Yiannis
——————————
neme.org | neme-imca.org | hblack.net | LABS

Offline

#24 2012-04-22 06:51:09

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 5,016
Website

Re: pat_referrers

Hi Patrick,

I slept over it and thought that your plugin could do the job if two enhancements were implemented

  1. Subdomain sniffing
  2. have a 0 value for redirect if not required

The code I was thinking of:

<txp:variable name="refpage" value='<txp:pat_referrers list="http://www.domain.tld/some_page, http://subdomain.domain.tld" redirect="0" />' />
<txp:if_variable name="refpage" value="http://subdomain.domain.tld/" />
<txp:some_tags />
</txp:if_variable>
<txp:if_variable name="refpage" value="http://www.domain.tld/some_page">
<txp:some_other_tags />
</txp:if_variable>

Edited to add a simpler code:

<txp:variable name="refpage" value='<txp:pat_referrers list="http://www.domain.tld/some_page, http://subdomain.domain.tld" redirect="0" />' />
<txp:if_variable name="refpage" value="" />
<txp:else />
<txp:some_tags />
</txp:if_variable>

Last edited by colak (2012-04-22 06:59:51)


Yiannis
——————————
neme.org | neme-imca.org | hblack.net | LABS

Offline

#25 2012-04-22 16:31:25

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,031
Website

Re: pat_referrers

Yiannis,

Container tag is’nt difficult, sub domains checker is more disfficult. I’ll provide a new version tomorow with container feature.

Offline

#26 2012-04-28 08:45:21

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,031
Website

Re: pat_referrers

v0.4 now available.

redirect attribute can be omitted (Thanks Colak).
external attribute added (v0.3): accepts external Url redirection (Thanks Ralitza).
status attribute added. If sets a “301 Moved Permanently” is send. Useful to tell search engine bots that the TXP section must never more to be indexed.
Help text updated.

Next (very difficult) challenge: subdomain sniffing.

Check, test, comment or hate :D

WP version available soon ;)

Last edited by Pat64 (2012-04-28 09:01:35)

Offline

#27 2012-04-28 14:43:49

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,031
Website

Re: pat_referrers

@Ralitza
@Colak

Just for you: v.05 available

Supports domain and sub domain names ;)

Check, test, comment, love or hate :D

Last edited by Pat64 (2012-04-28 15:16:09)

Offline

#28 2012-04-28 15:04:35

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 5,016
Website

Re: pat_referrers

hey Patrick, You did it!

Unfortunately I get

Parse error: syntax error, unexpected ')', expecting ';' in /home/xxx/xxx/textpattern/lib/txplib_misc.php(653) : eval()'d code on line 42
The above errors were caused by the plugin:pat_referrers 

The code I am using

<txp:variable name="refpage" value='<txp:pat_referrers list="http://sub.domain.com" />' />
<txp:if_variable name="refpage" value="" />
<txp:rvm_css format="link" />
<!--[if IE]>
<txp:rvm_css n="ie" format="link" />
<![endif]-->
<!--[if IE 7]><link rel="stylesheet" href="<txp:rvm_css name="ie7"/>" type="text/css" media="screen" /><![endif]-->
<txp:else />
<txp:pro_mobile> 
<link rel="stylesheet" media="handheld, only screen and (max-device-width: 480px)" href="/css/small_screen.css" />
<link rel="stylesheet" media="handheld, only screen and (min-device-width: 768px)" href="/css/default.css" />
<link rel="stylesheet" media="only screen and (-webkit-min-device-pixel-ratio: 2)" type="text/css" href="/css/small_screen.css" />
<txp:else />
<txp:rvm_css format="link" />
<!--[if IE]>
<txp:rvm_css n="ie" format="link" />
<![endif]-->
<!--[if IE 7]><link rel="stylesheet" href="<txp:rvm_css name="ie7"/>" type="text/css" media="screen" /><![endif]-->
</txp:pro_mobile>
</txp:if_variable>

> Edited to add: The error above appears on all pages, regardless of the template on the front end of the site on ‘live’ mode.

Last edited by colak (2012-04-28 15:07:02)


Yiannis
——————————
neme.org | neme-imca.org | hblack.net | LABS

Offline

#29 2012-04-28 15:15:32

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,031
Website

Re: pat_referrers

Sorry Colak. Corrected. Re-upload

Offline

#30 2012-04-28 19:44:49

Pat64
Plugin Author
From: France
Registered: 2005-12-12
Posts: 1,031
Website

Re: pat_referrers

… And finaly v0.6.alpha
A very experimental version where the plugin can be used as a single or a container tag.

Offline

Board footer

Powered by FluxBB