0

This is my first site in Craft CMS (coming from EE) and trying to get my head around a few things.

I've got a matrix field that defines various types of content - one of which is a 'Super Table' field. In this 'Super Table' field, I've got one particular field called 'linkText' which I'm trying to pull through. I did successfully BUT it came through 19 times. I've been trying to suss out where this number comes from.

I have a matrix field called 'pageContent'. The particular Block Type I'm looking at is called 'textBlock'. Within that block I then have a rich text field called 'Text' which pulls through perfect i.e. once as expected. I then have the troubled 'Super Table' field called 'callToAction' which has a linkType and linkText in there.

{% for block in entry.pageContent %}

    {% if block.type == "textBlock" %}

        {% for row in block.callToAction %}

             <p>{{ row.linkText }}</p>

        {% endfor %}

    {% elseif block.type == "customTable" %}

        etc, etc, 

    {% endif %}

{% endfor %}

I'm sure it's something stupid, it is late! ;) but been checking the docs for a while and can't solve it. Any help would be great.

  • Welcome JonnyT - Do you have 19 rows in 'Call to Action' ? – Matt P Mar 30 '16 at 8:54
  • Hi Matt, thanks for the reply. I just have one row but have since discovered it's because I had set 'Static' in the Super Table field. Not sure why that would return 19, I can guess that it's down to a static field being generic so has to be identified differently?! Strange! – JonnyT Mar 30 '16 at 17:56
  • Glad you figured it out man! – Matt P Mar 30 '16 at 18:35
1

In this case it was pulling through 19 rows only when 'Static Field' was selected. Everything was fine otherwise, possibly a way that the data was being pulled.

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.