1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

AddOn Version ID

Discussion in 'XenForo Development Discussions' started by mcatze, Apr 16, 2014.

  1. mcatze

    mcatze Well-Known Member

    Is it possible to get the Version ID of an AddOn in a template e.g. as an footer copyright?
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    I don't understand your example, but yes.

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

    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} ?
     
  4. Chris D

    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.
     
  5. mcatze

    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?
     
  6. Chris D

    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 likes this.
  7. mcatze

    mcatze Well-Known Member

    Yes, my fault. Wrong question, but thanks for your quick help.

    I take a look for a different way ..
     
  8. Chris D

    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 likes this.
  9. mcatze

    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: Apr 16, 2014
  10. Hoffi

    Hoffi Well-Known Member

    You can add a group to the debug mode. Not an simple setting.
     
    mcatze likes this.

Share This Page