0

I have migrated a channel to using a fluid field instead of the old setup of one body field and one extended text field. The fluid field includes a textarea and a grid field that of course can be used any number of times each.

I managed to sort out that the index displays only the first instance of the textarea and the first instance of the grid field even if there are more. I do that like this:

{westeros_content}

{westeros_content:westeros_text}
{if {westeros_content:count name="westeros_text"} == "1"}{content}{/if}
{/westeros_content:westeros_text}

{westeros_content:westeros_image}
{if {westeros_content:count name="westeros_image"} == "1"}
{content}
<div class="EntryImage">
<a href="http://{content:file}">{content:image:medium}</a>
</div>
{content:caption}
{/content}
{/if}
{/westeros_content:westeros_image}

{/westeros_content}

However, I would also like to offer a “read on” link IF there us more than one text field, and I can’t seem to figure out how to construct that. What I tried was this:

{if {westeros_content:count name="westeros_text"}  > "1"}
<div class="EntryExtended"><a href="http://{comment_url_title_auto_path}">read on >></a></div>
{/if}

And that gives me the following error:

Error
You have an invalid conditional in your template. Please review your conditionals for an unclosed string, invalid operators, a missing }, or a missing {/if}.

Parser State: Invalid Condition: Not enough operands for operator ” > “.

In Template “Announcements/index” on line 90

Removing the inner curly brackets also do not work, so I can’t quite figure out what I am missing here.

1 Answer 1

2

Put quotes around the first half of your conditional, and change the inner quotes to single quotes (to stop EE parser getting confused) - something like:

{if "{westeros_content:count name='westeros_text'}"  > "1"}

HTH

1
  • Thanks, that gets rid of the error! Still doesn't actually give a read on link when there's more than one instance of westeros_text, however, so I must have something else wrong with the syntax. Hrm. Apr 9, 2019 at 21:31

Your Answer

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

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