<p>That <code>entry</code> variable will only be predefined for the template when you go to one of your entry’s URLs.</p>

<p>Your section’s Entry URL Format for top-level entries is <code>{slug}</code>, and your entry’s slug is <code>qweasdzxc</code>, so that would make your entry’s URL <code>&lt;site-url&gt;/qweasdzxc</code> (<a href="http://localhost/qweasdzxc" rel="nofollow noreferrer">http://localhost/qweasdzxc</a>).</p>

<p>If you change your section’s top-level Entry URL Format to <code>reviews/{slug}</code> instead of just <code>{slug}</code>, then the entry’s URL will become <code>&lt;site-url&gt;/reviews/qweasdzxc</code>.</p>

<p>When you go to <code>&lt;site-url&gt;/reviews</code>, you’re just accessing the <code>reviews/index.twig</code> template directly, so the <code>entry</code> variable was never defined, which is causing the error you’re getting.</p>

CC BY-SA 4.0
2019-01-23T13:19:48.773Z
Thanks! Strange but I saw calls and selections from entry variable from index.twig template (related to similair section) from other devs, so I was confused.
Clark
CC BY-SA 4.0
2019-01-23T10:17:38.877Z
2019-01-23T10:17:38.877Z
Brandon Kelly
<p>So, the subject.
I am currently working with customer of craftcms v2.
I am setting up Structure Section where I want to add Entry Type for index listing of items and add some items in list.</p>

<p>So, here is my setup:</p>

<ol>
<li>Section: <a href="https://i.sstatic.net/quVtb.jpg" rel="nofollow noreferrer">https://i.sstatic.net/quVtb.jpg</a></li>
<li>Section EntryType: <a href="https://i.sstatic.net/RCglJ.jpg" rel="nofollow noreferrer">https://i.sstatic.net/RCglJ.jpg</a></li>
<li>Field Settings tab: <a href="https://i.sstatic.net/FCC8I.jpg" rel="nofollow noreferrer">https://i.sstatic.net/FCC8I.jpg</a></li>
<li>Field Layout tab: <a href="https://i.sstatic.net/xK4QY.jpg" rel="nofollow noreferrer">https://i.sstatic.net/xK4QY.jpg</a></li>
<li>Entry Example: <a href="https://i.sstatic.net/K0GFw.jpg" rel="nofollow noreferrer">https://i.sstatic.net/K0GFw.jpg</a></li>
</ol>

<p>I have 3 Entries added.
I made this setup exactly the same as was for same page type (Structure Section too). But page I did throws error as in subject title.</p>

<p>I've googled and found that the key for 'entry' object in template using is to check this option in Section settings:</p>

<p>'Entries in this section have their own URLs' </p>

<p>I found that in this article: <a href="https://straightupcraft.com/articles/the-craft-entry-variable" rel="nofollow noreferrer">https://straightupcraft.com/articles/the-craft-entry-variable</a></p>

<p>So, what may be the problem? This option is checked. Also exactly the same page (called Features) works well! It's kind of magic I think.</p>

<p>Simple code in template raises the error: <a href="https://pastebin.com/fjqeb1LT" rel="nofollow noreferrer">https://pastebin.com/fjqeb1LT</a>
I am using template in 'app/craft/templates/reviews/index.twig' folder.</p>

CC BY-SA 4.0
2019-01-22T17:24:59.633Z
Can you paste the complete code from index.twig where the "entry" is created?
phaetons
CC BY-SA 4.0
2019-01-22T17:53:43.287Z
What URL are you going to when you get this error?
Brandon Kelly
CC BY-SA 4.0
2019-01-23T10:07:32.390Z
@phaetons yes, here it is: https://pastebin.com/CH6RgGpC
Clark
CC BY-SA 4.0
2019-01-23T10:07:35.183Z
@BrandonKelly url is http://localhost/reviews
Clark
<craft2>
Variable "entry" does not exist in template at Structure Section
# Variable "entry" does not exist in template at Structure Section

(Asked by: username_0 on 2019-01-22)

So, the subject.
I am currently working with customer of craftcms v2.
I am setting up Structure Section where I want to add Entry Type for index listing of items and add some items in list.

So, here is my setup:

1. Section: <https://i.sstatic.net/quVtb.jpg>
2. Section EntryType: <https://i.sstatic.net/RCglJ.jpg>
3. Field Settings tab: <https://i.sstatic.net/FCC8I.jpg>
4. Field Layout tab: <https://i.sstatic.net/xK4QY.jpg>
5. Entry Example: <https://i.sstatic.net/K0GFw.jpg>

I have 3 Entries added.
I made this setup exactly the same as was for same page type (Structure Section too). But page I did throws error as in subject title.

I've googled and found that the key for 'entry' object in template using is to check this option in Section settings:

'Entries in this section have their own URLs'

I found that in this article: <https://straightupcraft.com/articles/the-craft-entry-variable>

So, what may be the problem? This option is checked. Also exactly the same page (called Features) works well! It's kind of magic I think.

Simple code in template raises the error: <https://pastebin.com/fjqeb1LT>
I am using template in 'app/craft/templates/reviews/index.twig' folder.

**Tags:** craft2

> **Comments:**
> **username_1**: Can you paste the complete code from index.twig where the "entry" is created?  
> **username_2**: What URL are you going to when you get this error?  
> **username_0**: @username_1 yes, here it is: https://pastebin.com/CH6RgGpC  
> **username_0**: @BrandonKelly url is http://localhost/reviews  

---

## 1 answers

### Answer by username_2 on 2019-01-23. Score: 2 | Accepted answer

That `entry` variable will only be predefined for the template when you go to one of your entry’s URLs.

Your section’s Entry URL Format for top-level entries is `{slug}`, and your entry’s slug is `qweasdzxc`, so that would make your entry’s URL `/qweasdzxc` (<http://localhost/qweasdzxc>).

If you change your section’s top-level Entry URL Format to `reviews/{slug}` instead of just `{slug}`, then the entry’s URL will become `/reviews/qweasdzxc`.

When you go to `/reviews`, you’re just accessing the `reviews/index.twig` template directly, so the `entry` variable was never defined, which is causing the error you’re getting.

> **Comments:**
> **username_0**: Thanks! Strange but I saw calls and selections from entry variable from index.twig template (related to similair section) from other devs, so I was confused.  

---

