Global area navigation flopping (templates?)

Permalink
I can't seem to find the issue and my test site seems perfect - its my live site that has this issue

I have been building a bootstrap theme using a free basic theme ChadStrat put up a while ago and I have had little to no issues modifying everything.

However after putting the theme live on my real site I noticed allot of issues with the navigation menu not rendering correctly. One of the problems is its a randomly occurring problem so I don't know how to dig for the problem.

The Nav is in a global area

<div class="select_nav styled-select"> is where the problem starts

the theme is supposed to select the menu, build the values then collapse them into a nice little nav

instead something in c5 breaks the call to <select> and creates the nav with a (default template)

The classes completely change

I have attached images of whats happening and the changes of the outputted code

I am hoping someone has had a similar experience and knows where I can look for the issue

4 Attachments

SheldonB
 
mesuva replied on at Permalink Reply
mesuva
This sounds a little bit like the problem that can happen when you change a normal editable area to a global area in a template, without changing the handle.

I.e., if you do this:
// directly change 
$a = new Area('Header Nav');
// to
$a = new GlobalArea('Header Nav');

bugs pop up where it flips between old and new content in the area.


I'm pretty sure I've read of this happening when people change between themes and something like 'Navigation' is used in one theme as the handle of a normal Area, and also used in the new theme in the GlobalArea.

So perhaps change the name of the handle to something you've not used before and re-add the autonav.

Just a suggestion!
SheldonB replied on at Permalink Reply
SheldonB
So change the 'Header Nav' to something like 'Header Nav2' - Should clean it up ?


is there a way to delete the old 'Header Nav'

I can see it has a wacky fix but i also see myself or someone 2 years from now reverting back to the old name

I wonder if there is a way just to purge a specific area
mesuva replied on at Permalink Reply
mesuva
You could just temporarily change the areas to just normal Area calls, with the original handles and delete any blocks that are present.

You could delete unwanted Global area via the stacks section in the dashboard.

The best thing to do though is to pick a new handle that hasn't been used already and not change it, maybe put a comment in your code! :-)
SheldonB replied on at Permalink Reply
SheldonB
rwar .. I wish there was better way for this
(that I had the foresight to plan for this)

I'll give it a try through

I don't like having to do stuff to a live site - I wish there was a way to identify whats what in the mysql to clean up the unwanted areas - I found the values for them but without matching the id im not sure what im looking at
mesuva replied on at Permalink Reply
mesuva
I think you might be overly concerned with 'cleaning it up' here, there's no real issue with having a few extra records in the database that aren't ever looked at - it's not going to affect performance or cause issues down the track.

All I'd do in this case is remove the unused Stack from the dashboard.
PatrickCassidy replied on at Permalink Reply
PatrickCassidy
You could just hard-code the nav in to the theme pages, then you wouldn't need a global editable area, it would just be there on each page. If that suits?

Code is like this:

<!-- Site Navigation -->
 <nav>
   <?php
   $nav = BlockType::getByHandle('autonav');
   $nav->controller->orderBy = 'display_asc';
   $nav->controller->displayPages = 'top';
   $nav->controller->displaySubPages = 'all';
   $nav->controller->displaySubPageLevels = 'custom';
   $nav->controller->displaySubPageLevelsNum = 1;
   $nav->render('view');
   ?>   
 </nav>
SheldonB replied on at Permalink Reply
SheldonB
Thanks guys - ive been playing with both I guess in the end hard coding the header would be the best solution since I don't really want it to change anymore