Structure admin page not working correctly

Dan Fisch's Avatar

Dan Fisch

16 Apr, 2012 03:44 PM

I have a website with a large number of entries in the structure plugin. When the structure page in the admin loads, about a quarter of the entries display as expected, but after a while the rest stop displaying inside the list. If an item is moved or added around the entire structure data structure gets messed up and becomes flat.

I've tried turning on the structure debug mode with no luck. If i turn on display php errors I get a lot of warnings at this point in the code:

A PHP Error was encountered
Severity: Notice
Message: Undefined offset: 695
Filename: views/index.php
Line Number: 43

  1. 1 Posted by Travis Schmeiss... on 16 Apr, 2012 04:22 PM

    Travis Schmeisser's Avatar

    What happens when you turn on the debug mode? That looks like a data issue that the debug mode gives you the option to fix.

  2. 2 Posted by Dan Fisch on 18 Apr, 2012 06:26 PM

    Dan Fisch's Avatar

    I attempted to turn on the debug mode and go to the debug menu. I got a message telling me that there were 18 entries with errors. I told structure to fix these entries, this appeared to fix the admin but now the navigation on the public facing side stopped working.

    The following template tag now displays no items:


    but the following tag will work


    I poked through the code for a little bit and found this query: SELECT structure.*, titles.title, titles.entry_date, titles.expiration_date, LOWER(titles.status) AS status FROM exp_structure AS structure LEFT JOIN exp_channel_titles AS titles ON (structure.entry_id = titles.entry_id) JOIN ( SELECT entry_id, lft, rgt FROM exp_structure WHERE entry_id = '0' AND site_id IN (0,'1') ) AS root_node ON (structure.lft BETWEEN root_node.lft AND root_node.rgt) OR structure.entry_id = root_node.entry_id WHERE structure.site_id IN (0,'1') AND (titles.entry_id IS NOT NULL OR structure.entry_id = 0) AND (structure.entry_id = 0 OR titles.entry_date < 1334772643) AND (structure.entry_id = 0 OR titles.expiration_date = 0 OR titles.expiration_date > 1334772643) ORDER BY structure.lft

    When looking at the database, i no longer have a row where entry_id = 0

    If I add a new row to the database with an entry_id of 0, 1 in the lft column, and 1778(one more than the highest rgt value) in the rgt column the navigation starts working. The debug page tells me that i now have 1 extraneous entry. Can I leave the database like this or is there something else I should do to fix it?

  3. 3 Posted by Dan Fisch on 18 Apr, 2012 06:30 PM

    Dan Fisch's Avatar

    I also want to mention that I was still getting the PHP notice about views/index.php on line 43. I've modified the file from:

    $add_url = BASE.AMP.'C=content_publish'.AMP.'M=entry_form'.AMP.'channel_id=' . $page['channel_id'] . '&parent_id=' . $eid . '&template_id=' . $site_pages['templates'][$eid];


        if( array_key_exists( $eid, $site_pages['templates'] )){
            $add_url  = BASE.AMP.'C=content_publish'.AMP.'M=entry_form'.AMP.'channel_id=' . $page['channel_id'] . '&parent_id=' . $eid . '&amp;template_id=' . $site_pages['templates'][$eid];
        } else {
            $add_url  = BASE.AMP.'C=content_publish'.AMP.'M=entry_form'.AMP.'channel_id=' . $page['channel_id'] . '&parent_id=' . $eid;
  4. 4 Posted by Travis Schmeiss... on 18 Apr, 2012 06:37 PM

    Travis Schmeisser's Avatar

    Try tha tag without the line breaks in the parameters first.

  5. 5 Posted by Dan Fisch on 18 Apr, 2012 07:23 PM

    Dan Fisch's Avatar

    Removing the line breaks made no difference.

  6. 6 Posted by Travis Schmeiss... on 18 Apr, 2012 07:35 PM

    Travis Schmeisser's Avatar

    Do you have an entry set to be the homepage with the URL of "/" ?

  7. 7 Posted by Dan Fisch on 18 Apr, 2012 08:29 PM

    Dan Fisch's Avatar

    No we do not, Our site is configured to use Expression Engine's default template as the homepage

  8. 8 Posted by Travis Schmeiss... on 18 Apr, 2012 08:30 PM

    Travis Schmeisser's Avatar

    That's probably the issue since "/" doesn't exist in our tree. You'll need to add a page/entry with the URL of "/" and assign it to the homepage template.

  9. 9 Posted by John Hoysa on 16 May, 2013 07:51 PM

    John Hoysa's Avatar

    Sounds exactly like the issue I am having as well. I updated Structure to 3.3.6 and EE is still at 2.5.2.

    I was able to replicate this on our QA version of the site as well. Our QA site is also a near replica of our live site so it makes sense this is happening there as well. Its just slightly different and I have included a screen shot of the PHP issue.

    We have had the site working fine now for about year. I had this issue happen twice when creating a new page a few months ago but the issue has not arisen since then.
    Now the issue is rather sever and I am noticing that my Structure URLs are disappearing and that I am not able to get some entries to show up correctly, deletion to the rescue.

    I have included two images of the issues. There is one image that includes the PHP errors.

    Again I am not sure the issue is with using an EE template as my sites index page since we have been running our site fine for a year now.

    I hope this helps not only Dan but the Structure team in trouble shooting the issue.

  10. 10 Posted by Travis Schmeiss... on 16 May, 2013 08:11 PM

    Travis Schmeisser's Avatar
  11. 11 Posted by John Hoysa on 16 May, 2013 08:32 PM

    John Hoysa's Avatar

    I went to mcp.structure.php and changed FALSE to TRUE like so - var $debug = TRUE;
    Line 24 in my copy of the file. I did not see a "Debug" button in the module area.

    I searched my config file in system > config > config.php and did not see any mention of $config[‘site_pages’], so I was not able to remove it.

    Am I missing something else?

  12. 12 Posted by John Hoysa on 16 May, 2013 08:37 PM

    John Hoysa's Avatar

    Ignore last message. Changed settings on our live site, not QA.

  13. 13 Posted by John Hoysa on 16 May, 2013 08:42 PM

    John Hoysa's Avatar

    Thanks Travis, everything on my end seems to be working now.

    I really appreciate the quick reply and help.

    Dan, good luck with your issues and I hope you solve them soon. Also thanks for letting me jump in on your support thread.


  14. 14 Posted by Travis Schmeiss... on 17 May, 2013 02:23 PM

    Travis Schmeisser's Avatar

    Dan, where are you at with your issue now? Seems this thread dropped off at some point and that may be our fault.

  15. 15 Posted by Marcus Cherry on 11 Jun, 2013 04:01 PM

    Marcus Cherry's Avatar

    Just in case this is useful for anyone:

    We had a similar problem after deleting a member and selecting the 'delete all entries' option. Deleting entries this way did not seem to delete them cleanly from structure.

    Running the debug tool fixed the issue nicely though.

  16. 16 Posted by Travis Schmeiss... on 11 Jun, 2013 04:24 PM

    Travis Schmeisser's Avatar

    Thanks for sharing! Good to know.

  17. Support Staff 17 Posted by Support on 16 Feb, 2017 04:00 PM

    Support's Avatar

    For future reference, we would recommend upgrading to Structure 4. Structure 4 has the ability to fix this, where in Structure 3.x it would just drop the problem causing pages out of Structure. (Please note, upgrading to Structure 4 when this problem is present will give you the ability to fix the existing broken pages from an older installed version of Structure)

    There also hasn't been a known case of this happening in Structure 4.

  18. 18 Posted by Daniel Edwins on 10 Apr, 2017 04:45 PM

    Daniel Edwins's Avatar

    We're currently having this problem for the second time with Structure 3.3.3. The debug mode fixed the issue the first time, but a lot of pages were orphaned in the process and all children URLs were set to the parent's URL so we needed to go through 100+ pages to fix all the URLs. Have you run into that issue before?

    I'm currently on EE 2.5.2. Is Structure 4 compatible with this version of EE?


  19. Support Staff 19 Posted by Support on 11 Apr, 2017 12:23 PM

    Support's Avatar

    Hi Daniel, yes, there have been a lot of upgrades to Structure, specifically with regard to it's new Validation system and ability to help identify and repair issues.

    Structure 4 should be compatible with 2.5.2. If you run into any issues, let us know and we'll get them sorted out for you.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Already uploaded files

  • Structure___ExpressionEngine.png 64.7 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac