Textpattern CMS support forum

You are not logged in. Register | Login | Help

#31 2018-07-16 15:19:09

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: Making your plugins 4.7-aware

michaelkpate wrote #313034:

You want to use “bc..” followed by the language the code is in: html, php, etc.

The more obvious it is, the less I remember… Thanks Michael !


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#32 2018-07-16 16:34:48

etc
Developer
Registered: 2010-11-11
Posts: 3,019
Website

Re: Making your plugins 4.7-aware

NicolasGraph wrote #313030:

Because the tag could be used by its own as a container, I uses return parse($thing, $out), however, its triggers an error when $out is false.

Thanks, this error is weird, will investigate.

Doing return $out ? $thing : ''; does work but it would not parse potential else contents.

You can not make global attributes work this way atm, because the $thing they get is generally already parsed (by the tag) and does not contain <txp:else /> anymore. We could (will?) introduce preparsing global attributes, but, in this case, there would be an ambiguity re the false part in, say

<txp:if_something if_something_else>...<txp:else />...</txp:if_something>

In my case I could check if the tag was used through the global attribute to conditionate the return, but it could be a problem if the global attribute wouldn’t have its own name I guess.
I don’t know if the parser should manage this kind of use or not, or if, has I aked before, there should be a convention about global attributes to name them differently than others; in which case checking the use of a global attribute could seem alright.

When the parser processes global attributes, $pretext['_txp_atts'] is set to true. You can check it, though this may change one day.


etc_[ query | search | pagination | date | tree | cache ]

Offline

#33 2018-07-17 06:56:12

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: Making your plugins 4.7-aware

etc wrote #313037:

Thanks, this error is weird, will investigate.

Ok, thanks.

You can not make global attributes work this way atm, because the $thing they get is generally already parsed (by the tag) and does not contain <txp:else /> anymore. We could (will?) introduce _pre_parsing global attributes, but, in this case, there would be an ambiguity re the false part in, say

Yes, I understand, I was just saying that return $out ? $thing : ''; would obviously not work if used through the tag with a potential else clause. I don’t try to use any else clause through the global attribute.

When the parser processes global attributes, $pretext['_txp_atts'] is set to true. You can check it, though this may change one day.

Noted.


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

Board footer

Powered by FluxBB