I have a search module that grabs locations based on coordinates and estimates distances. I've decided to extend then channel class so I can take advantage of the entries method to display search results. In my method, I use an sql query to find the entry_ids and estimated distance. I then have the following:

public function search_results() {
    $entry_ids = '4|24|265|23';
    $distances = array(

    ee()->TMPL->tagparams['entry_id'] = $search_ids;
    return parent::entries();

This works great with the following code in my template, with one problem:

        <h4><a href="/location/{url_title}">{title}</a></h4>

The "distance" is not a channel field, but that calculated value. Any suggestions on how I can inject that into the parsing per row?

1 Answer 1


You could create an extension which uses the channel_entries_query_result hook to add your variable to each entry row. That will get parsed along with the native vars. To pass data from your module/plugin file to the extension, you'd need to use the Session cache.

You might be interested to know that Low Search offers a straight forward API for custom filters, which basically extends the channel:entries tag, too. With it, in the same file, you can add your filter rules (which you have in your module/plugin file) and manipulate the output of the results (which you can do with an extension).

  • Thank you! That was the route I was planning on looking at today. You saved me from having to find the right hook and then realize the session cache piece.
    – koivi
    Dec 19, 2014 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.