last day (14 days later) » 

1:49 PM
1
Q: How to output a structure sub-navigation of current page

codeknightI've got a single structure menu for my entire site which consists of a title and a single related entry. I use that to output the main menu, which uses this code: <section class="top-bar-section"> <ul class="right"> {% nav link in craft.entries.section('menu') %} <li class="...

 
Why don't use use the structure for the content also? I don't see the benefits of using a bunch of singles and then have to manage the structure of them in a separate structure section using entries fields.
with "top level pages" you meant the singles, related to a top level entry from your structure, right?
 
Practically every page on the site has a different layout - and as far as I can tell it's not possible to set different templates for entries in a Structure channel
 
Yes you can! That's where entry types come into the game.
 
Entry types let you use different fields, not different templates (as far as I can tell)
 
Hey code knight, you didn't click the link I provided!
 
1:49 PM
Ahh ok I see - managed to miss that in the docs, thanks. Dynamic templates. Now my head is spinning with flexibility again ><
 
ck? you here?
 
Hi! - yes
 
:)
 
Never completely got the hang of how Structure channels were meant to be used - the docs doesn't really cover it as well as I'd expected
So I've been using it like my question - as a list of related entries for building menus
 
Already to late to refactor?
structure sections are very similar to channel sections.
 
2:04 PM
not necessarily too late
but why do singles exist if structure handles templating AND menu structure?
 
lol
I asked myself this very question this morning, hehe.
 
It looks like Structure is designed to handle "sections" of content, like in the example, it doesn't seem appropriate to use one structure channel for the whole site
 
There are totally capable of doing things like this!
P+T uses a structure sectio for the complete Craft documentation!
 
here's the site I'm working on - wireframes.savoyhop.codeknight.co.uk - for reference of the challenge I'm trying to solve
 
I think you could easily do it with a single structure.
If you carefully plan how to structure your modules, you actually wouldn't even need that many entry types.
 
2:18 PM
so then the templates file structure would look like

menu/_about
menu/_about/our_story
menu/_courses/weekly_courses
etc
whereas at the moment its

about/index
about/our_story
about/team
courses/_entry
courses/weekly-courses

etc
mm
 
A section only has one _entry.html and all the tempting goes into that one file.
Or you include separate partials depending on the entry type, like described in the help article i posted.
 
No it's melting my brain thinking about how to restructure it now, I'm gonna have to try it on a smaller project first!
 
But to be true, I wouldn't refactor the page. But consider this on your next project...
Yeah, just wanted to say that to you :)
 
I will do - thank you for taking the time to explain that :)
 
There a good Q/As on stack exchange about that topic!
 
2:26 PM
I'll give it another look next time round
It makes sense, but this project is complicated enough as it is
 
Yes, fine. I am also still on my first site using this approach. But I think it's very nice to have it all in one place. The content and the structure of it.
 
Yes the structure interface is lovely
Clients definitely appreciate drag & drop and reordering
 
I don't have that many pages with individual content and mostly use it for my channel's index pages.
 
Yes it makes sense for that
Most of this site is individual pages though, with some channel content on a few of the pages
 
Then even better, my "pages" structure doesn't have that much content to enter for my client :(
Here's a not so relevant post I made some days ago:
3
A: How do you handle complex navigation in Craft?

carlcsIf the {% nav %} tag doesn't give you enough control over the output, you can always replicate the behavior with custom loops and the getChildren() method. Just nest them as far as your navigation hierarchy possibly gets. Edit: Here an example code on how you'd dynamically call getChildren() on...

The question is not very good (as far as I remember), but I listed links to some other Q/As on that topic.
 
2:34 PM
Ah that's handy, thanks
 
Good luck with your dancing site, codeknight!
 
oh actually
using structure does solve one problem
clients can't create singles
which means they can't create pages
so heavily utilising structure means they can create new pages
 
Yeah thats good.
Leaving the room now, cu around! Cheers
 
thank you - c ya!
 

last day (14 days later) »