Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2013-02-03 14:30:53

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: [SOLVED] Plugin which counts days

I don’t know the contents of your custom3 field. Have you tried entering text manually into the variable? Furthermore I’d expect to have the output of the glx tag (not your cf3) define the content of the lastday variable as you’re comparing the variable against one of the tag’s possible outputs/results. Does any of that make sense?

Edit: Should the latter be the reason: As soon as you change the output for the span’s title e.g. from deadline to something else, the tag wouldn’t work any longer. So you’d better compare against a variable containing just >0 days.

Last edited by uli (2013-02-03 15:14:58)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#14 2013-02-03 15:14:37

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: [SOLVED] Plugin which counts days

The content of the cf3 varies. It is sometimes a word and sometimes the glx tag. The value I would like to compare with is the output of the edited glx plugin so as to change those little 0 days appearances.

Sample URL NeMe.org/arts_info/

Last edited by colak (2013-02-03 15:16:27)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#15 2013-02-03 15:16:41

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: [SOLVED] Plugin which counts days

colak wrote:

and sometimes the glx tag.

Well, then: Have you seen my edit above?


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#16 2013-02-03 15:31:55

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: [SOLVED] Plugin which counts days

Hi uli, thanks so much for your help for this one. Yes, I did see your edit, the deadline span title is produced by the edited plugin. Maybe I should edit it again so as to do away with the spans and see what happens.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#17 2013-02-03 15:39:38

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: [SOLVED] Plugin which counts days

colak wrote:

Hi uli, thanks so much for your help for this one.

You’re welcome.

Maybe I should edit it again so as to do away with the spans and see what happens.

It’ll at least minimise potential faults. But your produced output on the page is congruent with the if_variable’s content here above. I’m pretty clueless ATM.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#18 2013-02-03 15:56:06

etc
Developer
Registered: 2010-11-11
Posts: 5,192
Website GitHub

Re: [SOLVED] Plugin which counts days

colak wrote:

The content of the cf3 varies. It is sometimes a word and sometimes the glx tag.

What exactly?

Edit: just in case you have put <txp:some_tag /> in cf, this will not work, since it is not parsed by if_variable (nor by variable). You will be comparing the literal <txp:some_tag /> against <span.... You finally see the tags output because of the famous secondpass, imo.

Last edited by etc (2013-02-03 16:13:28)

Offline

#19 2013-02-03 16:26:11

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: [SOLVED] Plugin which counts days

etc wrote:

since it is not parsed by if_variable (nor by variable). You will be comparing the literal <txp:some_tag /> against <span....

For rationales like this, among other things, I’m here so often :) Now I’m curious.

Edit: Hm, pondering: Why then does Yiannis’ <txp:variable name="lastday" /> (quoted from above) output 0 days?

Last edited by uli (2013-02-03 16:28:36)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#20 2013-02-03 16:33:09

etc
Developer
Registered: 2010-11-11
Posts: 5,192
Website GitHub

Re: [SOLVED] Plugin which counts days

uli wrote:

For rationales like this, among other things, I’m here so often :) Now I’m curious.

Edit: Hm, pondering: Why then does Yiannis’ <txp:variable name="lastday" /> (quoted from above) output 0 days?

You know you can count on me. :)

The reason is, txp parses the page twice (whence secondpass). On the first pass, <txp:variable name="lastday" /> becomes <txp:some_tag />, which becomes what it should on the second pass.

Last edited by etc (2013-02-03 16:33:24)

Offline

#21 2013-02-03 16:57:41

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,306

Re: [SOLVED] Plugin which counts days

Hm, I’m really producing some heat above my ears, but simply because the cogs of my wheels don’t fit into each other. Let’s see whether I can explain where that friction comes from:

As you said …

You finally see the tags output because of the famous secondpass, imo.

… (which seems to be proven by the page’s output), which means it’s properly inserted into the variable:

Why does it work there, but isn’t it properly processed inside the if_variable tag which checks for the contents of exactly that variable? Really too bad that I’ve no background in coding.

Edit: orthograpy

Last edited by uli (2013-02-03 17:00:26)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#22 2013-02-03 17:11:25

etc
Developer
Registered: 2010-11-11
Posts: 5,192
Website GitHub

Re: [SOLVED] Plugin which counts days

My theory is:

  • at the beginning, variable contains literal <txp:tag />;
  • on the first pass, if_variable compares this literal with <span..., which comes false. So it outputs the false part, i.e. the value of the variable (literal <txp:tag />), and disappears;
  • on the second pass, <txp:tag /> produces its output.

How it sounds? If Yiannis enables debug mode, there should be a mention of secondpass: true somewhere in the source code. Otherwise, I am wrong, which is all but impossible.

Offline

#23 2013-02-03 17:28:55

etc
Developer
Registered: 2010-11-11
Posts: 5,192
Website GitHub

Re: [SOLVED] Plugin which counts days

uli wrote:

Why does it work there, but isn’t it properly processed inside the if_variable tag which checks for the contents of exactly that variable?

I guess I have missed the main question, sorry. It is processed, so <txp:variable /> becomes <txp:tag />. If if_variable were processed twice, this would give what Yiannis expects. But if_variable is no more there on the second pass, it has just left its true or false offspring and died.

Edit: it’s not each tag that is parsed twice separately, but the whole page.

Last edited by etc (2013-02-03 17:47:25)

Offline

#24 2013-02-03 17:45:24

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: [SOLVED] Plugin which counts days

Thanks Oleg, that makes sense… Kind of… So it seems that with my current setup there is no way to replace the particular text unless I added the variable tags within the cf which would be a real bother.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB