auto-nav "Header Menu" not working in Green Salad, in Plain Yoghurt it does

Permalink
Hi,

I'm new with C5 and trying it out.

In Plain Yoghurt the auto-nav block shows all the 3 Custom Templates of the auto-nav ("none", "Header Menu" and "Breadcrump") correctly when I switch between them.

However, in Green Salad design only the templates "none" and "Breadcrump" seems to work while "Header Menu" doesn't change the layout of the auto-nav block. Yet, I can see the results of switching between the 3 auto-navs in Green Salad in the css of the page:

"none" gives at the concerning place:
<div id="pageHeader">
                <ul class="nav">...

"Header Menu" changes the pages css to:
<div id="pageHeader">
                <ul class="nav-header">...

and "Breadcrump" gives:
<div id="pageHeader">
                ...


So, the 3 variations seems to take effect in the css of Green Salad as they should do, but "Header Menu" doesn't show the styling it should have, it keeps to be an unordered list without styling.

Maybe somehow the class “.nav-header” doesn't take effect on the unordered list in Green Salad? Can anyone help?

terano
 
mayoman7 replied on at Permalink Reply
I really wish I had a solution to this, but I am experiencing the same issue. I tried modifying the base CSS file to include just "nav" ul's instead of "nav-header", but with (strangely) no luck.

I double checked the autoNav creation PHP file and it says that it is returning an opening ul with the class id of "nav-header" but when my browser renders the page, it only shows up as "nav" which has no CSS affiliation, ergo, no pretty rendering.

In short, there seems to be a glitch with autoNav.

Also (semi-related), when creating new pages and then moving them to the top level, autoNav does not automatically include it with the header navigation menu until you go to the page properties, enable navigation exclusion, and then disable navigation exclusion before autoNav will include it. Possibly a missing database default when pages are created/moved? Just a thought...
mayoman7 replied on at Permalink Reply
@terano:

I found the solution to the "nav"/"nav-header" problem. The php file for auto nav actually writes the incorrect tag. I tried this with my problem and got the navigation menu rendering properly now.

Browse to /concrete/blocks/autonav and open "view.php"
Find the line that says:
echo("<ul class=\"nav\">");
It should be line 34.
Change "nav" to "nav-header".
Save and refresh your problematic page.

Chances are, you can look through that same file and find the breadcrumb problem line as well, although I'm not familiar with how that specifically works since I'm not implementing it on my site (yet).

Hope this helps!
terano replied on at Permalink Reply
terano
Thank you for replying mayoman7, I've made the test you're proposing: I changed in view.php at line 34 class=”nav” to class=”nav-header”.
It has effect, but not the desired: it gives now both the auto-nav Template “none” and “Header Menu” the css-class “nav-header” (within the div with id=”pageHeader”) as only “Header Menu” should have the class “nav-header” and “none” should have the class “nav”.

Because of this test I'm looking now closer at the main.css of Green Salad in contrast to the main.css of Plain Yoghurt (default theme) to discover how they prescribe the “nav-header” classes.

I've copied the Green Salad theme from /concrete/themes/greensalad into /themes/greensalad. There I modify the main.css to make some tests.

For a reason that I don't understand yet, I can change for example the #page #central #body background color (line 127), that works properly, but the header logo anchor color (line 57) refuses to change. This makes me think that there is a script that overrides some of the main.css including the nav-header classes. Am I thinking in the right way to the solution? Or am I missing a very basic thing?

Besides, sometimes at the end of a css-declaration a semicolon is missing. I've repaired that in my main.css, but it didn't make any difference. (well, Bluefish-editor stopped complaining about those semicolons :-) )
mayoman7 replied on at Permalink Reply
Also realize that my application here is for a third party CSS and converting myself into a theme for concrete. Also, this is being designed for a multi-user site where giving editing permissions to things like headers and navigation menus would be a big fat no-no, so I'm hardcoding a lot these AutoNav's into my pages.

With that, however, I have learned a lot while manually poking around in the AutoNav view.php, and controller.php files. While I probably shouldn't have been messing with such things, there is no documentation for this block yet, so you gotta do what you gotta do. (I was smart and had original copies, mind you.)

So anyway, I can pose to you this much. If you just want the top level of navigation in your header and never need the direct ability to change the navigation (it will still follow your site map), then you could do what I have accomplished and just add the AutoNav in your theme template.

To do this, use the following:
<?php
    $bt_main = BlockType::getByHandle('autonav');
    $bt_main->controller->displayPages = 'top';
    $bt_main->controller->orderBy = 'display_asc';                    
    $bt_main->controller->displaySubPages = 'none'; 
    $subnav->controller->displaySubPageLevels = 'enough';
    $bt_main->render('templates/header_menu');
?>


For your problem here, the render line is the most important. See how it references header_menu? That's actually header_menu.php which is located in /concrete/blocks/autonav/templates/. That specific file should be only used for your header template, which you can modify like we discussed earlier in this thread. That way all the other pages don't follow the specific CSS class/id and you should be set to go.

Once I found out how to hard code AutoNav's, I started using that as my preferred method rather than adding those via the concrete editing interface (where you'd have to manually add it for all your pages if it's a subnav).

Play around and definitely let me know how it works out. If you want more than just the top level in the main navigation menu, there is a way to do that too, although I'm having troubles myself in that area. Check out my latest discussion in the forum for that one:
http://www.concrete5.org/index.php?cID=243423...
terano replied on at Permalink Reply
terano
I was able to implement the autonav as you suggested (referencing with render to templates/header_menu). I've made some tests to be sure that indeed /blocks/autonav/templates/header_menu.php is used. It is, it passes through header_menu.php, only it still doesn't put out the right styling.

The difference in aspect of header_menu in Plain Yoghurt vs Green Salad, isn't that a pure css-question? I've started comparing the main.css of default and greensalad, without result until now.

Besides, autonav header_menu in the Header Nav (Green Salad) does work! Only autonav header_menu in the Header section does not work. In Plain Yoghurt in both sections (Header Nav and Header) it works fine.

Hardcoding is fine, but it should work simply from the edit-page as well.

Any further ideas?