• 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

#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:

Code:
        <ol class="searchResultsList">
            <xen:foreach loop="$results" value="$result" i="$i">
                {xen:raw $result}
            </xen:foreach>
        </ol>
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!
 

Jake Bunce

XenForo moderator
Staff member
#2
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