<p>I'm doing this at the moment. It's not a perfect solution, but nor is it terrible. In a lot of ways, I'd quite like Craft to just burn Singles and Channels and use nothing but Structures. You can do everything with Structures that you can with the other two, and you get better flexibility and much nicer groupings in the CMS that make more sense to clients (the one confusing bit of Craft clients seem to have is why editing pages is spread out over three areas they don't see any real logic behind). But, that's not how things are. Anyway...</p>

<p>If you're getting "entry does not exist" then you've got something broken in your routing. Every page inside a Structure is an Entry, and if you've got URLs resolving to entries in your Structure then you've got access to the entry variable in your template.</p>

<p>Check your Structure and see what template it's actually loading. The only thing I can think of at the moment with the little detail you've given is that you've got templates in a path that match the Structure, and instead of routing theough the database it's routing theough the files.</p>

<p>i.e., if you've got templates/my-structure/my-entry.twig and also an Entry with a URI of /my-structure/my-entry then you might be skipping the database because your filesystem is matching first.</p>

CC BY-SA 3.0
2017-07-18T15:56:03.097Z
I think it's the routing that I'm having issues with, but is something I often get confused by. Because there's not set "homepage" like there would be if I had a Single (`__HOME__`), it throws an error. If I append `/index` to the URL, I see the page I expect to see. So how do I use this structure's entry as the homepage?
Chrish
CC BY-SA 3.0
2017-07-19T07:36:58.327Z
I don't think Craft will let you have a non-Single as a homepage. A work-around would be to manually grab the Entry in the /templates/index.twig template. Just put something like `{% set entry = craft.entries.id('1') %}` at the top of the template - where the ID is the page ID of whatever Entry in your Structure you're wanting to treat as the homepage.
Matt Wilcox
CC BY-SA 3.0
2017-07-17T15:13:25.017Z
2017-07-17T15:13:25.017Z
Matt Wilcox
<p>Has anyone ever tried using Structures instead of Singles? I'm developing something that's kind of like multiple sites in one, they share the same central design, just with content differences and a few colour changes. I thought if I could use a Structure instead of Singles, I could contain each section to a specific area (making it easy to maintain), and use Entry Types to decide on the content.</p>

<p>The problem is with using a Structure is I keep getting <code>Variable "entry" does not exist.</code> errors. Any suggestions?</p>

<p>If anyone can suggest a fix, or a better way of handling something like this, I'd love to hear it!</p>

<p>Thanks</p>

<structure><content><singles><layout>
Using Structures instead of Singles
# Using Structures instead of Singles

(Asked by: username_0 on 2017-07-17)

Has anyone ever tried using Structures instead of Singles? I'm developing something that's kind of like multiple sites in one, they share the same central design, just with content differences and a few colour changes. I thought if I could use a Structure instead of Singles, I could contain each section to a specific area (making it easy to maintain), and use Entry Types to decide on the content.

The problem is with using a Structure is I keep getting `Variable "entry" does not exist.` errors. Any suggestions?

If anyone can suggest a fix, or a better way of handling something like this, I'd love to hear it!

Thanks

**Tags:** structure, content, singles, layout


---

## 1 answers

### Answer by username_1 on 2017-07-17. Score: 2 | Accepted answer

I'm doing this at the moment. It's not a perfect solution, but nor is it terrible. In a lot of ways, I'd quite like Craft to just burn Singles and Channels and use nothing but Structures. You can do everything with Structures that you can with the other two, and you get better flexibility and much nicer groupings in the CMS that make more sense to clients (the one confusing bit of Craft clients seem to have is why editing pages is spread out over three areas they don't see any real logic behind). But, that's not how things are. Anyway...

If you're getting "entry does not exist" then you've got something broken in your routing. Every page inside a Structure is an Entry, and if you've got URLs resolving to entries in your Structure then you've got access to the entry variable in your template.

Check your Structure and see what template it's actually loading. The only thing I can think of at the moment with the little detail you've given is that you've got templates in a path that match the Structure, and instead of routing theough the database it's routing theough the files.

i.e., if you've got templates/my-structure/my-entry.twig and also an Entry with a URI of /my-structure/my-entry then you might be skipping the database because your filesystem is matching first.

> **Comments:**
> **username_0**: I think it's the routing that I'm having issues with, but is something I often get confused by. Because there's not set "homepage" like there would be if I had a Single (`__HOME__`), it throws an error. If I append `/index` to the URL, I see the page I expect to see. So how do I use this structure's entry as the homepage?  
> **username_1**: I don't think Craft will let you have a non-Single as a homepage. A work-around would be to manually grab the Entry in the /templates/index.twig template. Just put something like `{% set entry = craft.entries.id('1') %}` at the top of the template - where the ID is the page ID of whatever Entry in your Structure you're wanting to treat as the homepage.  

---

