Nesting pages and drop-down menus

I'm trying to create a drop-down menu for our new 2.0 Omeka site. I've themed earlier versions of Omeka, but the new page organization scheme (via Exhibit Builder 2.0) has been a pain to style. My biggest problem is that for any pages which go more than 2 levels deep, the sub-pages don't even show up until you're on the parent page.

For example, let's say I have five pages:

Page 1
-Page 2 (child of Page 1)
--Page 3(child of Page 2, grandchild of Page 1)
Page 4
Page 5

If I'm on page 4, the only navigation links that display are for Pages 1, 4 and 5.

Basically, I'm trying to figure out how I can display ALL the links for ALL the pages associated with an exhibit. In the Berlin theme, it does what I want on the Summary page, displaying all the pages in a nice nested list.

This is the code that seems to do what I want:

<?php set_exhibit_pages_for_loop_by_exhibit(); ?>
<?php foreach (loop('exhibit_page') as $exhibitPage): ?>
<?php echo exhibit_builder_page_summary($exhibitPage); ?>
<?php endforeach; ?>

However, if I copy the code that shows all those nice nested links, and paste it into my Show.php page, the links display properly (and can be styled as drop-down menus) but they don't go to the right pages. Each link just lands you on the last page of the exhibit, whatever you click.

This is the code that's currently calling the navigation links in the theme:

<?php echo exhibit_builder_page_nav(); ?>

What can I replace the current code with to give me the fully expanded list of page links so I can do my menus right? I appreciate any and all suggestions, thank you!

Moving that same code into my show.php to test, the links seemed to work fine: each linked to the correct page.

Which exact version of Exhibit Builder are you using? I tested this against the most recent version: 2.0.3.

We're using Exhibit Builder 2.0.3 as well.

I should also add that when I copied the code from the Summary page into the Show page, the links *sort of* work. The URL is correct, and changes when you click on different links, but the body of the exhibit page never changes to the correct page.

For example, if I click on the link to go to Page #4, the URL will change to reflect the correct URL for Page 4, but the exhibit text in the body of the page remains that of Page 7.

Final addendum: I also discovered that when I use the code from the Summary page:

<?php set_exhibit_pages_for_loop_by_exhibit(); ?>
<?php foreach (loop('exhibit_page') as $exhibitPage): ?>
<?php echo exhibit_builder_page_summary($exhibitPage); ?>
<?php endforeach; ?>

and paste it into the Show page, the Summary page then no longer works either. The links just take you to a page that displays the correct URL in the address bar but only shows the content of the last page of the exhibit.

Is there a URL to pages we can look at so we can see more of what's happening?

Thanks

I haven't styled the menus yet, but
here it is.

If you can copy-paste the entire code of your show.php page, it will help confirm this, but here's my guess.

When the script gets to

<?php echo exhibit_builder_render_exhibit_page(); ?>

it always thinks that the page to render is the last one, because the loop through the pages for the navigation leaves the script thinking that the current exhibit page is the last one. That loop function sets a new current record at each iteration, and exhibit_builder_render_exhibit_page() renders the current one.

I haven't tested this, but I _think_ this will work.

Change that line in show.php to

<?php echo exhibit_builder_render_exhibit_page($exhibitPage); ?>

The $exhibitPage should be the current page for reals -- the one you expect.

If that doesn't work, I'd try adding this way at the top, before the loop for your navigation links:

<?php
$currentExhibitPage = $exhibitPage;
?>

Then do this instead:

<?php echo exhibit_builder_render_exhibit_page($currentExhibitPage); ?>

That's a guess just in case the $exhibitPage variable gets reset during the loop.

I'm not 100% on either of those, but hopeful that one of the two will work.

I just tried both fixes, and neither of them worked for me. For reference, here is the contents of my show.php page before I attempted the fixes:

<?php
echo head(array(
    'title' => metadata('exhibit_page', 'title') . ' &middot; ' . metadata('exhibit', 'title'),
    'bodyclass' => 'exhibits show'));
?>
<div id="navigation-container">

<nav id="exhibit-pages">
<ul>
        <?php set_exhibit_pages_for_loop_by_exhibit(); ?>
        <?php foreach (loop('exhibit_page') as $exhibitPage): ?>
        <?php echo exhibit_builder_page_summary($exhibitPage); ?>
        <?php endforeach; ?>
    </ul>
</nav>
 </div>
<div class="exhibit-page"><?php echo metadata('exhibit_page', 'title'); ?></div>

<div id="exhibit-container">
<?php exhibit_builder_render_exhibit_page(); ?>

<div id="exhibit-page-navigation">
    <?php if ($prevLink = exhibit_builder_link_to_previous_page()): ?>
    <div id="exhibit-nav-prev">
    <?php echo $prevLink; ?>
    </div>
    <?php endif; ?>
    <?php if ($nextLink = exhibit_builder_link_to_next_page()): ?>
    <div id="exhibit-nav-next">
    <?php echo $nextLink; ?>
    </div>
    <?php endif; ?>
    <div id="exhibit-nav-up">
    <?php echo exhibit_builder_page_trail(); ?>
    </div>
</div>
</div>

<?php echo foot(); ?>

Many thanks...I think I had the right diagnosis but wrong solution.

Instead of what I suggested first time around, try adding this immediately after the navigation-container div:

<?php set_current_record('exhibit_page', $exhibit_page); ?>

Hope that helps, and thanks for bearing with us.

Thanks for sticking with it! Unfortunately, it's still not working...but in a little different way this time, at least.

I wasn't sure if the difference between $exhibit_page and $exhibitPage was intentional or not, so I tried it both ways. The loop references $exhibitPage not $exhibit_page, in case it matters. If I use $exhibit_page nothing changes, and it still looks like it did before with the links being correct but only the last page of the exhibit being rendered. If I use $exhibitPage, I have a different problem.

If you check the link I posted earlier, you can see that nothing shows up after the search box. It's like the navigation-container div isn't closing, even though in my Show.php the HTML/Div tags are all the same and properly paired.

This is how my show.php page looks now:

<?php
echo head(array(
    'title' => metadata('exhibit_page', 'title') . ' &middot; ' . metadata('exhibit', 'title'),
    'bodyclass' => 'exhibits show'));
?>
<div id="navigation-container">
<?php set_current_record('exhibit_page', $exhibitPage); ?>
<nav id="exhibit-pages">
<ul>
        <?php set_exhibit_pages_for_loop_by_exhibit(); ?>
        <?php foreach (loop('exhibit_page') as $exhibitPage): ?>
        <?php echo exhibit_builder_page_summary($exhibitPage); ?>
        <?php endforeach; ?>
    </ul>
</nav>
 </div>
<div class="exhibit-page"><?php echo metadata('exhibit_page', 'title'); ?></div>

<div id="exhibit-container">
<?php exhibit_builder_render_exhibit_page(); ?>

<div id="exhibit-page-navigation">
    <?php if ($prevLink = exhibit_builder_link_to_previous_page()): ?>
    <div id="exhibit-nav-prev">
    <?php echo $prevLink; ?>
    </div>
    <?php endif; ?>
    <?php if ($nextLink = exhibit_builder_link_to_next_page()): ?>
    <div id="exhibit-nav-next">
    <?php echo $nextLink; ?>
    </div>
    <?php endif; ?>
    <div id="exhibit-nav-up">
    <?php echo exhibit_builder_page_trail(); ?>
    </div>
</div>
</div>

<?php echo foot(); ?>

I really appreciate all your help, and I hope we can find a solution!

Oh joy! It worked! I misinterpreted what you meant by "after the div", but I got it to work!

This is the final code that works:

<?php
echo head(array(
    'title' => metadata('exhibit_page', 'title') . ' &middot; ' . metadata('exhibit', 'title'),
    'bodyclass' => 'exhibits show'));
?>

<div id="navigation-container">

<nav id="exhibit-pages">

<ul>
        <?php set_exhibit_pages_for_loop_by_exhibit(); ?>
        <?php foreach (loop('exhibit_page') as $exhibitPage): ?>
        <?php echo exhibit_builder_page_summary($exhibitPage); ?>
        <?php endforeach; ?>
    </ul>
</nav>

 </div>
   <?php set_current_record('exhibit_page', $exhibit_page); ?>
<div class="exhibit-page"><?php echo metadata('exhibit_page', 'title'); ?></div>

<div id="exhibit-container">

<?php exhibit_builder_render_exhibit_page(); ?>

<div id="exhibit-page-navigation">
    <?php if ($prevLink = exhibit_builder_link_to_previous_page()): ?>
    <div id="exhibit-nav-prev">
    <?php echo $prevLink; ?>
    </div>
    <?php endif; ?>
    <?php if ($nextLink = exhibit_builder_link_to_next_page()): ?>
    <div id="exhibit-nav-next">
    <?php echo $nextLink; ?>
    </div>
    <?php endif; ?>
    <div id="exhibit-nav-up">
    <?php echo exhibit_builder_page_trail(); ?>
    </div>
</div>
</div>

<?php echo foot(); ?>

THANK YOU!

I was looking for a better organized exhibit navigation and came across this bit:

<nav id="exhibit-pages">
    <ul>
        <?php set_exhibit_pages_for_loop_by_exhibit(); ?><br />
        <?php foreach (loop('exhibit_page') as $exhibitPage): ?><br />
        <?php echo exhibit_builder_page_summary($exhibitPage); ?><br />
        <?php endforeach; ?>
    </ul>
</nav>

and it almost works the way I want it.

If there was a way to add the "current" class to the relevant menu items, this would be so perfect.

I'm going to see if I can hack my way there.