<p>Thanks everyone for taking a look. I forgot that I had implemented something on the receiving templates that allowed you to navigate between articles from the newsletter, if the referral url was the newsletter. After I implemented the text only block, I forgot to change this to ignore those blocks.</p>

CC BY-SA 4.0
2018-05-17T01:08:16.477Z
2018-05-17T01:08:16.477Z
Jono
<p>Receiving the standard error:</p>

<blockquote>
  <p>Craft\MatrixBlockModel and its behaviors do not have a method or
  closure named "sectionArticles".</p>
</blockquote>

<p>The problem is that this error doesn't make sense. Here is why:</p>

<ol>
<li>I have a newsletter template with the block 'sectionArticles'</li>
<li>It lists entries from 3 different sections</li>
<li>These 3 sections do not have a block 'sectionArticles' nor a reference to it in their templates.</li>
<li>If I click on a link that leads to the url for these entries, I receive the above error</li>
<li>If I copy and paste the url into a new tab everything is fine</li>
<li>This only recently started happening. In other words, old issues of the newsletter are fine</li>
</ol>

<p>Help?</p>

<p>Here is code for referring template:</p>

<pre><code>{% for block in entry.connectionsContent %}
  {% switch block.type %}
    {% case "connectionsTextOnly" %}
      &lt;div class="{{ block.backgroundColor }} page-section"&gt;
        &lt;div class="row"&gt;
          {% set asset = block.sectionImage.first() %}
          {% if asset %}
            &lt;div class="large-3 medium-4 small-12 columns large-push-9 medium-push-8"&gt;
              &lt;img src="{{ asset.url }}"&gt;
            &lt;/div&gt;
            &lt;div class="large-9 medium-8 small-12 columns large-pull-3 medium-pull-4"&gt;
          {% else %}
            &lt;div class="small-12 columns"&gt;
          {% endif %}
              {{ block.sectionText }}
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
    {% default %}
      {% set entries = block.sectionArticles %}
      {% if entries | length %}
        &lt;div class="{{ block.backgroundColor }} page-section article-grid"&gt;
          &lt;div class="row large-up-4 medium-up-2" data-equalizer data-equalize-on="medium"&gt;
            {% for entry in entries %}
              {% if entry.section.handle == "news" %}
                {% include 'news/_includes/feed' %}
              {% elseif entry.section.handle == "pages" %}
                {% include 'pages/_includes/feed' %}
              {% elseif entry.section.handle == "events" %}
                {% include 'events/_includes/feed' %}
              {% endif %}
            {% endfor %}
          &lt;/div&gt;
        &lt;/div&gt;
      {% endif %}
    {% endswitch %}
{% endfor %}
</code></pre>

<p>The feed templates are just links and display fine.</p>

<p>The errors occurs on the events/_entry, news/_entry and pages/_entry templates. There is no references of the block 'sectionArticles' in those templates.</p>

<p>One more thing: the error only happens on scheduled entries, where the Post Date is in the future, after the Post Date has arrived.</p>

CC BY-SA 4.0
2018-05-14T15:03:19.470Z
can you please share the template code that seems to be throwing this error?
Jalen Davenport
CC BY-SA 4.0
2018-05-14T23:20:25.193Z
How is `block` getting defined in your template?  Are you looping through all of your Matrix blocks?
Brad Bell
CC BY-SA 4.0
2018-05-15T20:59:39.920Z
I updated above to include the block and switch. After further research, it turns out that the error is thrown only when a "connectionsTextOnly" block exists.

Still doesn't answer the question of why it throws the error after you leave
Jono
CC BY-SA 4.0
2018-05-16T00:01:06.580Z
By using `{% default %}`, you're saying that every block not named `connectionsTextOnly` is going to have a `sectionArticles` field in it... is that the case?
Brad Bell
CC BY-SA 4.0
2018-05-17T00:47:44.383Z
correct. There are only two block types.
Jono
<templating><matrix><error-message><error><error-handling>
Internal Server Error: missing method or closure
# Internal Server Error: missing method or closure

(Asked by: username_0 on 2018-05-14)

Receiving the standard error:

Craft\MatrixBlockModel and its behaviors do not have a method or
  closure named "sectionArticles".

The problem is that this error doesn't make sense. Here is why:

I have a newsletter template with the block 'sectionArticles'
It lists entries from 3 different sections
These 3 sections do not have a block 'sectionArticles' nor a reference to it in their templates.
If I click on a link that leads to the url for these entries, I receive the above error
If I copy and paste the url into a new tab everything is fine
This only recently started happening. In other words, old issues of the newsletter are fine

Help?
Here is code for referring template:
{% for block in entry.connectionsContent %}
  {% switch block.type %}
    {% case "connectionsTextOnly" %}
      
        
          {% set asset = block.sectionImage.first() %}
          {% if asset %}
            
              
            
            
          {% else %}
            
          {% endif %}
              {{ block.sectionText }}
            
          
        
    {% default %}
      {% set entries = block.sectionArticles %}
      {% if entries | length %}
        
          
            {% for entry in entries %}
              {% if entry.section.handle == "news" %}
                {% include 'news/_includes/feed' %}
              {% elseif entry.section.handle == "pages" %}
                {% include 'pages/_includes/feed' %}
              {% elseif entry.section.handle == "events" %}
                {% include 'events/_includes/feed' %}
              {% endif %}
            {% endfor %}
          
        
      {% endif %}
    {% endswitch %}
{% endfor %}

The feed templates are just links and display fine.
The errors occurs on the events/_entry, news/_entry and pages/_entry templates. There is no references of the block 'sectionArticles' in those templates.
One more thing: the error only happens on scheduled entries, where the Post Date is in the future, after the Post Date has arrived.

**Tags:** templating, matrix, error-message, error, error-handling
> **Comments:**
> **username_1**: can you please share the template code that seems to be throwing this error?  
> **username_2**: How is `block` getting defined in your template?  Are you looping through all of your Matrix blocks?  
> **username_0**: I updated above to include the block and switch. After further research, it turns out that the error is thrown only when a "connectionsTextOnly" block exists.  Still doesn't answer the question of why it throws the error after you leave  
> **username_2**: By using `{% default %}`, you're saying that every block not named `connectionsTextOnly` is going to have a `sectionArticles` field in it... is that the case?  
> **username_0**: correct. There are only two block types.  

---

## 1 answers

### Answer by username_0 on 2018-05-17. Score: 1

Thanks everyone for taking a look. I forgot that I had implemented something on the receiving templates that allowed you to navigate between articles from the newsletter, if the referral url was the newsletter. After I implemented the text only block, I forgot to change this to ignore those blocks.


---

