Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-07-09 08:26:43

ax
Plugin Author
From: Germany
Registered: 2009-08-19
Posts: 165

if_version tag?

In view of anticipated changes in upcoming Textpattern versions, that could be non-compliant with existing applications, perhaps there is a need for a <txp:if_version> tag, that would allow more easily to up-/downgrade the whole system?

Last edited by ax (2015-07-09 08:27:26)

Offline

#2 2015-07-09 09:49:29

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: if_version tag?

+1


TXP Builders – finely-crafted code, design and txp

Offline

#3 2015-07-09 11:11:22

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: if_version tag?

+1

Offline

#4 2015-07-09 11:31:49

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

Re: if_version tag?

Isn’t that doable with reverse thinking and the <txp:if_plugin name="xyz_plugin" version="4"> tag? Not really.

Last edited by uli (2015-07-09 13:17:35)


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

Offline

#5 2015-07-09 11:59:04

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

Re: if_version tag?

What version would it parse for those who use the svn or hacked installs?


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

Offline

#6 2015-07-09 13:29:39

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: if_version tag?

<txp:adi_globals name="version" />

<txp:if_variable name="version" value="4.5.7">
	Latest release!
</txp:if_variable>

Offline

#7 2015-07-09 13:59:48

ax
Plugin Author
From: Germany
Registered: 2009-08-19
Posts: 165

Re: if_version tag?

gomedia wrote #292973:

<txp:adi_globals name="version" />...

Perfect!

Offline

#8 2015-07-09 14:09:04

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

Re: if_version tag?

ax wrote #292975:

Perfect!

At least if no further releases are planned. :) Such a tag could be useful for themes, indeed, but it needs more power than simple equality check:

<txp:etc_query globals="prefs" functions="strnatcmp" query="strnatcmp('{?version}', '4.6')>=0">
	New era
<txp:else />
	Outdated version
</txp:etc_query>

Offline

#9 2015-07-09 14:58:19

ax
Plugin Author
From: Germany
Registered: 2009-08-19
Posts: 165

Re: if_version tag?

etc wrote #292976:

At least if no further releases are planned. :) Such a tag could be useful for themes, indeed, but it needs more power than simple equality check:

<txp:etc_query globals="prefs" functions="strnatcmp" query="strnatcmp('{?version}', '4.6')>=0">...

Very interesting tag. Thanks!

Offline

#10 2015-07-10 00:41:32

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: if_version tag?

And to skin the cat one more time:

<txp:adi_globals name="version" />

<txp:rah_function call="version_compare" version1='<txp:variable name="version" />' version2="4.5.7" operator=">" _is="TRUE">
	<txp:variable name="version" /> is the future
<txp:else />
	<txp:rah_function call="version_compare" version1='<txp:variable name="version" />' version2="4.5.7" operator="<" _is="TRUE">
		<txp:variable name="version" /> is the past
	<txp:else />
		<txp:variable name="version" /> is the present
	</txp:rah_function>
</txp:rah_function>

Offline

#11 2015-07-10 09:00:20

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

Re: if_version tag?

Damn! How do I get the last word?.. maybe

<txp:etc_query url="http://textpattern.com/" functions="version_compare" globals="prefs"
	query="version_compare(string(//p[@class='versionNumber']), '{?version}', 'le')"
>
	You are on the edge
<txp:else />
	Please upgrade
</txp:etc_query>

Offline

#12 2015-07-10 09:42:32

ax
Plugin Author
From: Germany
Registered: 2009-08-19
Posts: 165

Re: if_version tag?

gomedia wrote #292994:

<txp:adi_globals name="version" />...

Actually, I think that this is a nice example for the power and versatility of the Textpattern system. Not only do plugins seamlessly integrate into the textpattern syntax, but can be combined almost ad libitum, in this example with txp:rah_function. Thereby, an amazingly simple application logic can be generated, which rests upon highly intelligent plugins and would otherwise require much expertise and programming efforts. Theses benefits of Textpattern over competing CMS could be explained more clearly on the Textpattern homepage.

Offline

Board footer

Powered by FluxBB