<p>In your current code, the <code>entry</code> variable is actually an instance of <a href="https://craftcms.com/docs/templating/elementcriteriamodel" rel="nofollow noreferrer">ElementCriteriaModel</a>, which is probably the reason you're getting errors.</p>

<p>In order to set <code>entry</code> to an actual <a href="https://craftcms.com/docs/templating/entrymodel" rel="nofollow noreferrer">EntryModel</a>, you'll need to add a call to <code>first()</code>:</p>

<pre><code>{% set entry = craft.entries.id(72).first() %}
...
</code></pre>

CC BY-SA 3.0
2017-01-18T19:18:08.107Z
That solves it. Thank you. But why does the other template not require me to set the entry?
CreateSean
CC BY-SA 3.0
2017-01-18T19:25:50.420Z
I'm guessing that the other template is the _Entry Template_ for that particular Single section, in which case Craft will automatically populate the `entry` variable with the correct entry for you. Perhaps you can set the not-working template as the Entry Template for your other Single … in which case the above isn't neccessary. Just pop open the relevant Section via Settings -> Sections, and add the appropriate template path to "Entry Template" field.
Mats Mikkel Rummelhoff
CC BY-SA 3.0
2017-01-18T18:21:45.113Z
2017-01-18T18:21:45.113Z
Mats Mikkel Rummelhoff
<p>Now I've run into a really odd issue. I've got a hero include that is working elsewhere on the site, but on this one single it's not working at all. On a working "Single" the code is this</p>

<pre><code>{% extends "_layout" %}

{% block content %}


{% include '_includes/hero'
  with {
    imageName : 'page-hero-about',
    className : 'about',
    imageAlt  : 'Photo of store front',
    findStore : false,
    leadCols  : 'col-md-6',
    leadClass : 'lead'
  }
%}
</code></pre>

<p>And on the other non-working single the code is this:</p>

<pre><code>{% extends "_layout" %}

{% block content %}

    {#{% set entry = craft.entries.id(72) %} #}

    {% include '_includes/hero'
      with {
          imageName : 'page-hero-mission',
          className : 'mission',
          imageAlt  : 'Teaching people to read',
          findStore : false,
          leadCols  : 'col-md-9',
          leadClass : ''
     }
%}
</code></pre>

<p>On the non working page if I don't set the entry id I get a variable "entry" does not exist (though this is not needed on the working single). However once I do set that I get this error <code>Object of class Craft\ElementCriteriaModel could not be converted to string</code> Have googled but can't seem to find anything.  Also the code is pretty much identical so am at a loss</p>

<templating><error-message><include>
Template Errors with Include on Single Entry
# Template Errors with Include on Single Entry

(Asked by: username_0 on 2017-01-18)

Now I've run into a really odd issue. I've got a hero include that is working elsewhere on the site, but on this one single it's not working at all. On a working "Single" the code is this
{% extends "_layout" %}

{% block content %}


{% include '_includes/hero'
  with {
    imageName : 'page-hero-about',
    className : 'about',
    imageAlt  : 'Photo of store front',
    findStore : false,
    leadCols  : 'col-md-6',
    leadClass : 'lead'
  }
%}

And on the other non-working single the code is this:
{% extends "_layout" %}

{% block content %}

    {#{% set entry = craft.entries.id(72) %} #}

    {% include '_includes/hero'
      with {
          imageName : 'page-hero-mission',
          className : 'mission',
          imageAlt  : 'Teaching people to read',
          findStore : false,
          leadCols  : 'col-md-9',
          leadClass : ''
     }
%}

On the non working page if I don't set the entry id I get a variable "entry" does not exist (though this is not needed on the working single). However once I do set that I get this error Object of class Craft\ElementCriteriaModel could not be converted to string Have googled but can't seem to find anything.  Also the code is pretty much identical so am at a loss

**Tags:** templating, error-message, include


---

## 1 answers

### Answer by username_1 on 2017-01-18. Score: 2 | Accepted answer

In your current code, the entry variable is actually an instance of ElementCriteriaModel, which is probably the reason you're getting errors.
In order to set entry to an actual EntryModel, you'll need to add a call to first():
{% set entry = craft.entries.id(72).first() %}
...

> **Comments:**
> **username_0**: That solves it. Thank you. But why does the other template not require me to set the entry?  
> **username_1**: I'm guessing that the other template is the _Entry Template_ for that particular Single section, in which case Craft will automatically populate the `entry` variable with the correct entry for you. Perhaps you can set the not-working template as the Entry Template for your other Single … in which case the above isn't neccessary. Just pop open the relevant Section via Settings -> Sections, and add the appropriate template path to "Entry Template" field.  

---

