AddOn Version ID

mcatze

Well-known member
Is it possible to get the Version ID of an AddOn in a template e.g. as an footer copyright?
 

Chris D

XenForo developer
Staff member
I don't understand your example, but yes.

{$xenAddOns.addonId} will return the add-on version ID
 

mcatze

Well-known member
I wrote a little addon and would like to show the version id of this addon in the template, e.g. "Copyright 2014 v1.01"

Can you give me a little bit more examples, i am a newbie with coding .. ;)

How can i get my addon in {$xenAddOns.addonId} ?
 

Chris D

XenForo developer
Staff member
When you created your add-on in the Admin CP, you gave it an add-on ID and a version string.

Just use {$xenAddOns.addOnId} in the template.

Replace addOnId with your add-on ID.
 

mcatze

Well-known member
This gives me the full ID like 10002. What i need is the version_string. Is there an possibility to show this?
 

Chris D

XenForo developer
Staff member
You asked for the version ID.

No, that isn't possible unless you cache it separately, or perform a database query to get it.
 

mcatze

Well-known member
Yes, my fault. Wrong question, but thanks for your quick help.

I take a look for a different way ..
 

Chris D

XenForo developer
Staff member
Create an option in the Admin CP assigned to your add-on. Make it only visible in Debug Mode. Populate that manually with the version string.

Then you can use {$xenOptions.addOnVersion} in the template.

Replace addOnVersion with whatever the option ID is.

It means you have to do it manually, but unless you write some custom code it's the only way to do it.
 

mcatze

Well-known member
This is an great idea. I think i've seen something likes this in some addons or styles .. Thanks again.

EDIT: You wrote "Make it only visible in Debug Mode". But i can't find this option.
 
Last edited:
Top