Header Nav disappeared from second Page Type- Why?

Permalink
My Header Nav disappeared from my secondary page type for some inexplicable reason. There is not any CSS styling that has interfered (just thoroughly tested that) and everything about the default.php and secondary_page.php is the same except I deleted 4 editable areas and added 1 new one instead.

The div with Header Nav in it is exactly the same:
<div id="topNavigation">
           <?php $a = new Area('Header Nav'); $a->display($c); ?>
      </div><!--/topnavigation-->


To see the problem, please view the homepage here:
http://www.wal-rich.com/index.php...

and the secondary page here:
http://wal-rich.com/index.php/new-products/...

According to the Sitemap, the New Products page is a child of Home and it disappears and reappears as I collapse and expand the Home directory... so, definitely all part of the same Parent/child system and I'd think they should be able to share the same menu.

 
zoinks replied on at Permalink Reply
Yeah, the problem only happens with the secondary_page.php template I made. If I use one of the standard Page Types, the Header Nav shows up, but of course the page is not styled the way I want, so that's no good.

What's the different about the standard page types and the new one I made? I thought since it was basically the same thing as "default.php" it should work fine.
zoinks replied on at Permalink Reply
Okay, If I go into Edit mode, I have the option to ADD NEW CONTENT TO THE HEADER NAV AREA.

Haha!

So, obviously, something has happened where C5 is no longer recognizing this code below "as one of its own:"

<?php $a = new Area('Header Nav'); $a->display($c); ?>

^ This is the exact same code I have in the default.php and the Navigation shows up/works fine on those pages. I thought C5 had claimed this code as its own which meant it automatically recognized it is not an editable area, but the Header Nav.

This is the kind of thing that should definitely be mentioned in the Page Types documentation:
http://www.concrete5.org/documentation/general-topics/page-types...

Where can I find the fix? Must be somewhere or everyone would be having this problem.
andrew replied on at Permalink Reply
andrew
Child pages is something of a misnomer. Adding a page UNDER a page that has a header nav item won't necessary put a header nav on that page. The header nav has to be added to the "defaults" page of the type that is being added to the site. So if you have a "secondary" page type, you need to go into dashboard > pages and themes > page types, and find the defaults button for the page type you're adding, then add the block there. Then to add it to existing pages of that type click "setup on child pages" and choose the products page.
zoinks replied on at Permalink Reply
thank you, that makes sense... but what code should I put in there? According to the video I watched about turning an HTML template into a C5 theme, the only code he added for the Navigation was this:
<?php $a = new Area('Header Nav'); $a->display($c); ?>


I have no idea what I should put in there instead.
zoinks replied on at Permalink Reply
Well, I just added an Auto-Nav block and that seems to have worked in the "defaults" section where you edit the page, but it's not showing up.

So, I assume I need to find the "setup on child pages" area. Where is that located? I don't see it anywhere.
zoinks replied on at Permalink Best Answer Reply
After effing around for another couple hours, I finally found it.

I'm going to answer the question thoroughly and mark it "helpful" for future people (and likely me again).

-------- ON SECONDARY PAGE TEMPLATES --------

• do NOT use the same code you used to add Header Nav to the default page, which is this: <?php $a = new Area('Header Nav'); $a->display($c); ?>

• INSTEAD, just add an Editable Area that does not have the Concrete5 reserved name 'Header Nav' (for clarity). Instead give it a sensible name like 'Put Auto Navigation Block Here' like this:
<?php $a = new Area('Put Auto Navigation Block Here'); $a->display($c); ?>


• Make sure your php template has no strange characters (underscores, etc.). A good name would be "secondarypage.php."

-------- WHEN ADDING NEW PAGE TYPES --------

• When you are adding a new Page Type (under Pages and Themes > Page Types), make sure your Page Type's Handle has the same name as your php file (without the .php suffix). If it does not match, the Page Type will use default.php... and you don't want that.

(ie. if your php template is called "secondarypage.php" make sure your Page Type Handle is "secondarypage").

• If you're wondering what a "Handle" is, you will see it when you add a new Page Type. At the top left of the dialogue box is where you name the Page Type and at the top right is where you name the Handle.

QUICK SUMMARY:
Create a new Page Type with the Handle of "secondarypage" to match your "secondarypage.php" template.

• Click "update page type." This will bring you back to the main Page Types area.

• Click the "default" button next to the "secondarypage" Page Type you just created. This will bring up your template for viewing.

• If the template is not already in Edit mode, click Edit and then click where it says "Add to Put Auto Navigation Block Here"...

• Add the Auto-Nav block.

You will see the Auto-Nav block appear in your template, but you are not finished!

• Click the Area again and scroll down to the last option, "set up on Child Pages." Yes, that's right, for every single new child you ever create of this Page Type, you are going to need to forever click here and check next to it just so that the navigation appears on those pages.....

ADDENDUM: I just added a new page not from the Site Map area, but from my New Products Secondary Page. I just added a new page for Contact and it just automatically added the Header-Nav without my having to do all this clicking around, so maybe after you set it up once to add to all existing Child Pages, it automatically does it for all new ones.

Problem solved.