Developer
Supported
Entry linking
Back to this add-on's main page
View Other Add-ons From Yuri Salimovskiy
Can’t get conditionals to work
Support Request
|
Visiluna
|
| Posted: 13 December 2011 07:20 AM |
|
|
|
|
I just bought your plugin and I can’t get conditionals to work.
Here is my code (nested inside the {exp:channel:entries} tag for a single entry).
{exp:entry_linking entry_id="{entry_id}" link="prev" channel="my_channel" orderby="entry_order" sort="ASC" status="open" mode="short" no_results="empty"} {if no_prev_link} No Prev {if:else} <a href="{path=template_group/template/{link_url_title}}">Prev</a> {/if} {/exp:entry_linking} {exp:entry_linking entry_id="{entry_id}" link="next" channel="my_channel" orderby="entry_order" sort="ASC" status="open" mode="short" no_results="empty"} {if no_next_link} No Next {if:else} <a href="{path=template_group/template/{link_url_title}}">Next</a> {/if} {/exp:entry_linking}
Despite the check for “no_next_link” and “no_prev_link”, nothing at all is output when these are empty.
Please advise,
Philip Jones
|
|
|
|
|
Yuri Salimovskiy
|
| Posted: 13 December 2011 10:09 AM |
# 1
|
|
|
Developer
|
Hello Philip,
did you try setting no_results=“cycle” (or simply removing it)?
Also, plugin will not return any results if you have less that 3 entries.
If you want to change that behaviour, edit line 159,
checnge
if ($result->num_rows()<=2)
to
if ($result->num_rows()==0)
|
|
|
|
|
Visiluna
|
| Posted: 13 December 2011 10:12 AM |
# 2
|
|
|
|
no_results=“empty” and I have 32 entries. Are you saying that ‘no_results’ has to be set to cycle for the conditionals to work? I’ll give that a try.
Here is the tag I used:
{exp:entry_linking entry_id="{entry_id}" link="prev" channel="my_channel" orderby="custom_order" sort="ASC" status="open" mode="short" no_results="empty"}
|
|
|
|
|
Yuri Salimovskiy
|
| Posted: 13 December 2011 10:15 AM |
# 3
|
|
|
Developer
|
Can you tell me what it outputs with and without the conditionals?
|
|
|
|
|
Visiluna
|
| Posted: 13 December 2011 11:50 AM |
# 4
|
|
|
|
It outputs exactly the same thing either way.
Without conditionals:
If there is a valid “prev” link, it correctly displays the HTML within the tags. If there is no “prev” link, it displays nothing.
With conditionals:
If there is a valid “prev” link, it correctly displays the HTML within the tags. If there is no “prev” link, it ignores the conditionals and displays nothing.
NOTE: Here I reference a ‘prev’ link, but the behavior is the same whether I have requested a ‘prev’ link or a ‘next’ link.
|
|
|
|
|
Yuri Salimovskiy
|
| Posted: 13 December 2011 12:12 PM |
# 5
|
|
|
Developer
|
This is expected behaviour with no_results=“empty”. Try removing this parameter.
|
|
|
|
|
Visiluna
|
| Posted: 14 December 2011 10:44 AM |
# 6
|
|
|
|
That fixed it! Thanks for the help.
|
|
|
|