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

Variables in templates

Discussion in 'XenForo Development Discussions' started by Robust, Sep 22, 2015.

  1. Robust

    Robust Well-Known Member

    I have created a column called 'column' in xf_post, for example

    If I use {$post.column} or {$message.column} (in templates post and message, respectively), would it refer to the database or some cached value?
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    Database
     
  3. Robust

    Robust Well-Known Member

    @Chris D Right, I imagined so, so I have a situation here then.

    Template modification to: message

    Replace:
    Code:
    <xen:if is="{$xenOptions.baShowVoteRibbon} AND {$message.bestanswers} >= {$xenOptions.baVoteIndicatorMinimumVotes} AND in_array({$thread.node_id}, {$xenOptions.baEnabledForums})"><strong class="apBAVoteIndicator"><span></span>{xen:phrase bestanswer_voteindicator, 'votes={$message.bestanswers}'}</strong></xen:if>
    // debug line below
    {$message.bestanswers}
    This gives me: 1 If I use another account and click the vote button, it says 2. So it's incrementing by one. That's not what is in the database.

    [​IMG]

    bestanswers is 1500. If I make a vote, the $post.bestanswers is increased by 1, however the database increases by 50 (as expected, some usergroups can have more power to affect the vote), so it's not a problem on the PHP code end of things, the database is being edited as it should, something is just wrong with the addition of it into the template.
     
  4. Robust

    Robust Well-Known Member

    There was interference by other fields also available ($user.bestanswers or something?). Renamed the field and it works like a charm. Merci @batpool52!
     
    batpool52! likes this.

Share This Page