1

Has anyone else experienced pages showing up that shouldn't be when using the Structure module?

For example, let's say I have a channel called Pages and a page structure like so in the Structure module:

+ Parent Page         (structure url: parent, template: parent/index)
|- Sub Page           (structure url: child1, template: parent/child)
|- Sub Page           (structure url: child2, template: parent/child)
|- Sub Page           (structure url: child3, template: parent/child)
+ Parent Sibling Page (structure url: sibling, template: sibling/index)

Currently the channel entries tag looks like this:

{exp:channel:entries channel="pages"
  disable="categories|category_fields|member_data|pagination|trackbacks"
  cache="yes" refresh="180" require_entry="yes" limit="1"}

Nothing unusual there. So no surprises when we see the correct page showing when navigating to mysite.com/parent/child1.

However, if we changed the URL in the address bar to go to mysite.com/parent/sibling I do not expect to see the parent's sibling page... it's not in the same path at all!

After some investigation, it appears that the channel entries tag is simply falling back on its default functionality, but that is far from desired in this scenario, especially as we have strict URLs on.

Any clues on how I can solve this?

(running EE 2.5.5 and Structure 3.3.8)

0

On mobile so I must be brief... Try this in your Channel Entries tag:

{exp:channel:entries
    ...other params...
    dynamic="no"
    entry_id="{structure:page:entry_id}"}

That way you force the entry id to get the right page.

| improve this answer | |
  • Thanks for the suggestion. However, this results in an even more unusual behaviour when the URL requested doesn't match a page... the channel entries tag now somehow finds a random page and serves that instead. (I'm guessing something in the Structure plugin is matching the URL incorrectly to a page ID) – simonhamp Apr 25 '16 at 10:24
  • Huh, I use structure a lot and hard forcing the structure page entry_id usually works perfectly.,. I notice you are a bit out of date on EE and Structure, perhaps it's a bug. – jrothafer Apr 25 '16 at 12:47
  • Perhaps... will be upgrading soon so will try again then and cycle back with further input. – simonhamp Apr 25 '16 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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