Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2015-07-09 08:26:43
- ax
- Plugin Author
- From: Germany
- Registered: 2009-08-19
- Posts: 166
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
Offline
Offline
#4 2015-07-09 11:31:49
- uli
- Moderator

- From: Cologne
- Registered: 2006-08-15
- Posts: 4,319
Re: if_version tag?
Isn’t that doable with reverse thinking and the Not really.<txp:if_plugin name="xyz_plugin" version="4"> tag?
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
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: 166
Re: if_version tag?
Offline
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: 166
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
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: 166
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
Re: if_version tag?
ax wrote #293009:
amazingly simple application logic can be generated, which rests upon highly intelligent plugins and would otherwise require much expertise and programming efforts.
That’s what we love about it :-)
Theses benefits of Textpattern over competing CMS could be explained more clearly on the Textpattern homepage.
I agree. Care to throw digital rocks at Phil and see if it can be folded into the new site?
Or perhaps better, write us a blog post about it and we’ll stick it on the .com site.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#14 2015-07-10 14:53:04
- gomedia
- Plugin Author
- Registered: 2008-06-01
- Posts: 1,373
Re: if_version tag?
Offline
Re: if_version tag?
I wrote a plugin that output a version number in 2005 but it didn’t include a conditional. But I was curious how the coding worked.
<txp:mkp_if_version version="4.5.7">
<meta name="Textpattern" content="<txp:mkp_version />" />
<txp:else />
<meta name="Textpattern Classic" content="<txp:mkp_version />" />
</txp:if_variable>
Offline
Pages: 1