Resolved Get the number of posts on a page in thread_view?

Discussion in '[bd] Widget Framework' started by DeltaHF, Sep 15, 2016.

  1. DeltaHF

    DeltaHF New Member

    I want to show more widgets in the sidebar of my thread_view if there are more than X number of posts displayed on the page, and fewer widgets if the are less than X number of posts displayed on the page. The goal is to prevent the sidebar from becoming unnaturally long and pushing down the footer and the total height of the page if a thread has a small number of replies.

    Is this number stored in a variable somewhere within XenForo that I can use in the widget's Expression field?

    As an awkward workaround, I have been using $postsRemaining to determine if we're viewing the last page of a thread or not, but this is far from perfect and I was curious to know if there might be something better out there.

    Note: I have upgraded to a Webmaster package but the payment has apparently not cleared from PayPal yet.
     
  2. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    Which version of the add-ons are you using? If you are using the beta one, this should work

    Code:
    {xen:count $posts} < 10
     
    DeltaHF likes this.
  3. DeltaHF

    DeltaHF New Member

    Thanks!

    I'm still using the old version, the one that's listed in the XenForo Resource Manager. Will that still work? Should I upgrade to the beta?
     
  4. xfrocks

    xfrocks XenForo rocks!
    Staff Member

    In that case, you may try this for the expression

    Code:
    count($posts) < 10
     
    DeltaHF likes this.
  5. DeltaHF

    DeltaHF New Member

    Perfect! Thanks so much. :D

    Keep up the great work on the Widget Framework.
     
    xfrocks likes this.
Loading...