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

Accessing post and thread variables on search result page

Discussion in 'Troubleshooting and Problems' started by Stephen Melton, Sep 25, 2012.

  1. Hello there!

    I'm looking to be able to access the results of $post and $thread on the search result page, which are a part of $results. It looks like the results page is doing:

            <ol class="searchResultsList">
                <xen:foreach loop="$results" value="$result" i="$i">
                    {xen:raw $result}
    So if I do a xen:dump on $result inside of the loop, there's all sorts of stuff available. For instance, I can dump $search, or $userFieldsInfo, but if I try to dump $thread or $post, I just get NULL back. I can see them there when I dump $result, but I'm not sure how to access them!

    Thank you for any help and insights!
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Within the search_results template those results are already rendered. The dump information you see is the template object which can't be indexed into like most template variables. You need to go to these templates which represent the individual results of their respective types:

    Admin CP -> Appearance -> Templates
    > search_result_post
    > search_result_thread
    Stephen Melton likes this.
  3. Aha, exactly what I needed!

    Thanks Jake my man, you've done it again!

Share This Page