2

I have the following code on a listings page that is meant to display linked events that occur in the future.

{reverse_related_entries weblog="events" sort_by="date" show_expired="no"}
    {if count==1}
    <div id="upcomingevents">
        <dl class="meta">
            <dt>Upcoming Events</dt>
    {/if}

        <dd><a href="/events/{entry_date format="%Y/%m/%d"}">{title}</a></dd>
{if count==total_results}</dl></div>{/if}
{/reverse_related_entries}

The problem is that ALL linked events are being displayed, even those that have expired (as in the expired date is in the past)

My version is 1.7.1

4

The {reverse_related_entries} does support only 6 parameters of weblog, status, sort, orderby, offset, limit.

So "show_expired" parameter will not work here.


In that case I always prefer to use Playa but never tried with EE v1.6+.

I think, you are populating a single weblog entry and would like to show all the parents weblogs with {reverse_related_entries} tag.

Below is the example code with query module:

{exp:query sql="SELECT exp_weblog_titles.entry_id AS EntryID, exp_weblog_titles.title AS EntryTitle, exp_weblog_titles.url_title AS URLTitle FROM exp_weblog_titles 
LEFT JOIN exp_relationships ON exp_relationships.rel_parent_id=exp_weblog_titles.entry_id
WHERE exp_relationships.rel_child_id='{entry_id}' 
AND exp_weblog_titles.status='open' 
AND exp_weblog_titles.entry_date >= UNIX_TIMESTAMP(NOW()) 
ORDER BY exp_weblog_titles.entry_date DESC"}

{EntryID} || {EntryTitle} || {URLTitle}

{/exp:query}

Note in above code, {entry_id} in WHERE condition which the entry_id of child weblog and this code will replace the {reverse_related_entries} tag so {entry_id} of child weblog will be checked.

I didn't test this code but hoping it would work fine. Also, if you would like to fetch other fields, you need put with the SELECT statement.

| improve this answer | |
  • Thanks, Bashkar. So do you have any suggestions on how I could filter out the expired entries? – Martin Duys Mar 14 '13 at 3:47
  • Martin, let me see if I can find any solution for it, sure I 'll update here. – Bhashkar Yadav Mar 14 '13 at 12:12
  • It would also be fantastic if you could upvote my question. I'm finding it very frustrating that I cannot upvote people's answers because I am new on the site :-) and haven't reached my 15 reputation yet. – Martin Duys Mar 14 '13 at 17:58
  • See the updated answer. – Bhashkar Yadav Mar 14 '13 at 19:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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