Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-07-12 21:09:42

bmsorg
New Member
Registered: 2009-02-25
Posts: 7

output current version?

I feel like there should be an easy way to do this, or a tag, but I’ve had no luck discovering how…

does anyone know how to output the current version of a textpattern site on the front-end?

thanks,
Brandon
bmsorg

Offline

#2 2009-07-12 22:08:47

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: output current version?

<txp:php>
echo safe_field('val', 'txp_prefs', 'name = "version"');
</txp:php>

Last edited by jm (2009-07-12 22:09:04)

Offline

#3 2009-07-12 22:53:39

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 999
Website

Re: output current version?

There is also mg_txpversion.

Offline

#4 2009-07-12 22:58:32

bmsorg
New Member
Registered: 2009-02-25
Posts: 7

Re: output current version?

Awesome, thanks so much.

Just curious though… (I know only the very basics of php), how come when I tried to echo $thisversion, it doesn’t work? I notice in the txp index.php file it get’s assigned like this… $thisversion = ’4.0.8’;

No problem if you don’t get around to this inquiry, or if it’s too much of a pain to explain. Just curious and thought I’d ask in the event it’s a simple explanation. Thanks again.

Offline

#5 2009-07-12 23:02:37

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: output current version?

bmsorg wrote:

Just curious though… (I know only the very basics of php), how come when I tried to echo $thisversion, it doesn’t work?

It’s not a global variable, so it’s inaccessible. However, you should actually use

<txp:php>
echo $GLOBALS['prefs']['version'];
</txp:php>

instead of the code I posted because it saves a DB query. I forgot the prefs table ends up in $prefs, but mg_txpversion reminded me :).

Last edited by jm (2009-07-12 23:02:52)

Offline

#6 2009-07-13 01:18:17

bmsorg
New Member
Registered: 2009-02-25
Posts: 7

Re: output current version?

thanks, that makes sense now. i appreciate the explanation and update!

Offline

Board footer

Powered by FluxBB