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

XF 1.5 $category.lastPost - can we get more than 1?

Discussion in 'Styling and Customization Questions' started by shri, Jul 27, 2016.

  1. shri

    shri Member

    Is there a way in which we could get more than 1 post to display in a node_category_level_2 template?

    I'd like to be able to show a list of 5 latest topics.

    Trying to restyle the home page to look more like a newspaper with

    ---- Topic 1
    ---- Topic 2
    ---- Topic 3

    Bonus - if I can show a thumbnail of an attached image in that topic. :)
  2. Mike

    Mike XenForo Developer Staff Member

    This would require custom development.
  3. shri

    shri Member

  4. Mike

    Mike XenForo Developer Staff Member

    I'm not familiar with the API's working (it's by a third-party), so I couldn't really comment. I'd likely lean to trying to do it via PHP though, but that may just be my preference. :)
  5. shri

    shri Member

    Thanks. Just realised it is a 3rd party API. Will continue digging around to see how this can be done.

    Despite having been on this forum since 2010, I'm really installing and testing this beast for the first or second time. :)
  6. shri

    shri Member

    From another thread, @Brogan said this:

    Sort of new here, but spent the last few hours reading through this thread ( https://xenforo.com/community/threads/how-to-use-template-hooks.13167 ), as I'm keen to inject some new data into the node_forum_level_2 hook.

    Was looking at adding some data to the form param for display on the home page.

            <xen:hook name="node_forum_level_2_before_lastpost" params="{xen:array 'forum={$forum}'}" />
    The data would be a list of 5-10 latest threads in that forum. The template would then loop and render those appropriately.

    Can you point me to a doc or another thread which might give me some more clarity on the new way of doing things?

    Also, I noticed that this is a single line hook. Does not encapsulate the whole lastpost block. Can I just go ahead, create a new template where the lastpost part of the template is wrapped and render appropriatly in my hook?

    Change to

            <xen:hook name="node_forum_level_2_before_lastpost" params="{xen:array 'forum={$forum}'}">
            <div class="nodeLastPost secondaryContent">

Share This Page