0

This is really foxing me. I've got a single 'layout' template that is called as a wrapper by all my other 'content' templates (i.e. {layout="layouts/_general_layout"}). Part of the layout template provides the main navigation; three items in that navigation have sub-menus (which are just unordered lists). The list items inside those ULs are generated dynamically, from channel entry data. It all works fine for every 'content' template… except three.

When these three templates (let's call them The Problems) call the layout, one or more of the navigation sub-menus in the layout do not get generated. The <ul>s are left empty. Exactly which of the three <ul>s get missed is different for each of the Problems.

What is perplexing me is that I can only think of two ways in which the content template can affect the output of the layout template: layout variables (either as a parameter or via the {layout:set} tag, or by having conditionals in the layout that vary things according to the URL segments.

I do have some layout variables artwork in my content templates, but they only act to set meta tags for SEO. And there are no segment-checking conditionals around the missing dynamically-generated submenus.

The missing content is actually missing, not just hidden with CSS. Turning javascript off makes no difference. I've even commented out EVERYTHING inside the ‘Problem’ content templates except for the {layout="layouts/_general_layout"} tag (and removed the layout variable parameters for good measure) and the issue persists. So presumably the issue lies in the layout itself, but I absolutely cannot see the problem, since it works perfectly for every other content template.

As additional info, let me say that all three Problems are part of the same template group: news/year, news/month, and news/article. However, news/index does not trigger the problem — that one works just fine.

So: Can anybody suggest what other factors (other than segment-based conditionals and layout variables) might cause a layout to miss out/not parse chunks only when called by specific content templates?

(I'l post template code if required, but that might mean quite a bit of code, so I thought I'd ask without it first).

1 Answer 1

0

Ugh. It's solved, courtesy of Mr Boyink over on the Ellis Labs forum. And the solution was nothing more complex (and, for me, shaming) than our old friend dynamic="no".

The fact that the layout was working fine for 75% of the site's templates had made me look for something more complex, thinking that if the problem lay in the channel:entry tags then the problem would manifest for all pages of the site. Once Mike guessed what the problem might be, I realised what it is that sets the problem templates apart from all the others: they are the only ones in the site that are not the index templates of their respective template groups. So they are the only ones that would require the benefit of dynamic="no".

Still, I hate being caught out by that parameter. Thought I was past that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.