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

Array info with helper - Basic template functions?

Discussion in 'Styling and Customization Questions' started by Mathis Neumann, Feb 2, 2013.

  1. Hi there,
    I want to find out how many items are in an array in a template file, is there something like <xen:helper array_size $array> or something?
    Because there will be more things I need, like multiplying a width with the array size or subtraction.
    More commonly to avoid following questions: Is there a list of all accessable features you can use in a template file?

    Thanks :)
  2. Chris D

    Chris D XenForo Developer Staff Member

    There's a number of helpers all defined in library/XenForo/Template/Helper/Core.php that should help.

    Specifically you want

    {xen:count $array}

    And also

    {xen:calc 5 + 5}
    RastaLulz likes this.
  3. Does something like this work: {xen:calc {xen:count $array}+5}? or save the return of the count in a variable?
  4. Chris D

    Chris D XenForo Developer Staff Member

    That should work -- I think
  5. Nope. Template Syntax error...
    Can I store it in a variable and maybe use that, like $count={xen:count $array} and {xen:calc 100/$count}?

Share This Page