In my training weblog I have defined the {lessonid} custom field.
In the following code…
{exp:weblog:entries weblog="training" category_group="2" style="linear"}
In this weblog entries block this variable would get filled in: {lessonid}
{reverse_related_entries}
... but now that I'm in the reverse_related_entries block this no longer gets filled in: {lessonid}
{/reverse_related_entries}
{/exp:weblog:entries}Since that didn’t work, I tried to assign it to the on-page template variable {var_lessonid}
{assign_variable:var_lessonid="{lessonid}"}
Lesson ID: {var_lessonid} # this gets echoed properly
{reverse_related_entries}
Lesson ID: {var_lessonid} # this does not get echoed properly. the variable is blank.
{/reverse_related_entries}As you can see, I set a variable to equal the value of the {lessonid} custom field. Then I echoed that variable, opened a reverse_related_entries block and echoed it again.
{var_lessonid} displays outside the block, but does not display inside.
Then I tried assigning a non-custom-field-based value to {var_lessonid}...
If I change the above code to ...
{assign_variable:var_lessonid="test"}
Lesson ID: {var_lessonid}
{reverse_related_entries}
Lesson ID: {var_lessonid}
{/reverse_related_entries}... ‘test’ gets output both inside and outside the block as expected.
Why isn’t a custom field passed to a variable getting through to the inside of a {reverse_related_entries} block, but a plain text string is?
How can I get the parent’s custom fields to pass into a {reverse_related_entries} block?