Hello Ingmar,
I’ve done my homework.
Here we go for the reduced template case study.
If I am not using exp:weblog:entries loop, everything works flawlessly, with advanced conditionals or not and whatever the code order
{if embed:entry_id == ""}
{if embed:current_section == "multimedia"}
in multimedia
{if:else}
not in multimedia
{/if}
{/if}
{if embed:entry_id != ""}
{title}
{if embed:current_section == "multimedia"}
in multimedia
{if:else}
not in multimedia
{/if}
{/if}
You can switch things around, staring with the second condition, no problem.
If you are using a exp:weblog:entries loop anywhere in either branches, you can only use simple conditionals inside the exp:weblog:entries loop. That’s logical, given the fact that parse order is as follows:
1. simple conditionals
2. main parsing
3. advanced conditionals
{if embed:entry_id == ""}
{if embed:current_section == "multimedia"}
in multimedia
{if:else}
not in multimedia
{/if}
{/if}
{if embed:entry_id != ""}
{exp:weblog:entries entry_id="{embed:entry_id}" dynamic="off" status="not closed"}
{title}
{if embed:current_section == "multimedia"}
in multimedia
{/if}
{if embed:current_section != "multimedia"}
not in multimedia
{/if}
{/exp:weblog:entries}
{/if}
Again, here, you can switch first level branches around in your code, no problem.
When you start playing with relationships (here reverse_related_entries) and special conditionals like {if no_reverse_related_entries}, things get very senstitive with code order. The only way I could make this work is by:
1. Switching back to advanced condtionals inside the “special conditional” {if no_reverse_related_entries}
2. Putting the branch with the exp:weblog:entries loop at the end of my code (the other way around does not work at all).
{if embed:entry_id == ""}
{if embed:current_section == "multimedia"}
in multimedia
{if:else}
not in multimedia
{/if}
{/if}
{if embed:entry_id != ""}
{exp:weblog:entries entry_id="{embed:entry_id}" dynamic="off" status="not closed"}
{reverse_related_entries}
there are related entries
{if no_related_entries}
no related entries
{if embed:current_section == "multimedia"}
in multimedia
{if:else}
not in multimedia
{/if}
{/if}
{/reverse_related_entries}
{/exp:weblog:entries}
{/if}
I still cannot find a logical explanation to this behaviour / source code order dependency. I would definitely appreciate if someone can come up with a logical explanation to this. I am stumped.
Anyway, I’ve got this working ... so I think you can close this thread, unless the challenge appeals to one of you ;o)
Many many thanks to all of you for looking into this.