Exclude pages from secondary navigation menu

Permalink
I have an autonav sidebar menu working perfectly with pages excluded by 'Exclude from nav'.

I have a secondary footer autonav menu with a different template, based on autonav view.php.

I wish to exclude some pages from the secondary footer menu.

Searching yields references to copying the 'Exclude from nav' code from view.php and changing it for one's own attribute handle. However, view.php no longer contains 'Exclude from nav' code.

What code should I place where in my autonav template to be able to exclude pages from my secondary navigation?

Thank you.

graphiczweb
View Replies: View Best Answer
juliandale replied on at Permalink Reply
juliandale
I would add a new page attribute called something like 'Exclude from Footer Nav' (Dashboard > Pages & Themes > Attributes) and then use your custom autonav template to filter out any pages with that attribute.

Let me know if you need help to get it to work and I'll give more detailed instructions.
graphiczweb replied on at Permalink Reply
graphiczweb
" I'll give more detailed instructions"

Hi Julian

That is exactly what I would like if that is possible. As I said all the references so far talk about copying and changing the include in nav lines of code, but that is no longer present.

An explanation of where to add code to the auto nav layout to exclude or include by custom attributes would be a great help and I guess not just to me.

Thank you.

Jonathan
graphiczweb replied on at Permalink Reply
graphiczweb
I would be very grateful if you could describe the coding necessary to use a custom autonav template to filter out any pages with a custom attribute (eg: exclude_from_Footer_nav)

I think there a great many people who would value this advice if you were kind enough to give it.

Thank you
juliandale replied on at Permalink Reply
juliandale
Sorry, I've not been on the forum for a few days.

There's a simple way to do what you want using the 'is_featured' page attribute. Add an AutoNav block to your footer, then within the block settings there is already a filter set up to show featured pages, which you could use to show the pages you want to appear within the footer nav. To use it, you have to add a Checkbox page attribute with the handle is_featured and then edit the properties of all the pages you want in the footer and tick that new attribute. Check out this thread for how to do it:
http://www.concrete5.org/community/forums/usage/how-to-add-the-andq...

If you really want to change the AutoNav block, try searching the forum for 'Override Core' and see what comes up. This looks like a decent thread on the topic:
http://www.concrete5.org/community/forums/customizing_c5/override-c...

I hope that helps.
mhawke replied on at Permalink Reply
mhawke
I believe the Page List is the block that uses the 'is_featured' attribute, not the AutoNav.
graphiczweb replied on at Permalink Reply
graphiczweb
All the hits on e forum say look for:

$isFirst = true;
foreach($aBlocks as $ni) {
    $_c = $ni->getCollectionObject();
    if (!$_c->getCollectionAttributeValue('exclude_nav')) {


And change exclude_nav for the attribute you want. This code is no longer in autonav view.php

Please can anyone show me how to add this code to a copy of the current autonav view.php to make a new template? I really cannot believe that such a basic piece of functionality can be so hard.

Thank you
mhawke replied on at Permalink Reply
mhawke
The basic problem is that the AutoNav was the second piece of code ever written for concrete5 and so it's a little convoluted.

Overriding it requires that we figure out where to put the override copy of '[root]/concrete/core/controllers/blocks/autonav.php' file which contains the snippet you are looking for. I'm working on it without much success so if anyone with more experience in overriding the AutoNav controller with a custom template would like to chime in here, that would be great.
mhawke replied on at Permalink Best Answer Reply 1 Attachment
mhawke
Ok, download the attached file and rename it to 'view.php'

Put it in: '[root]/blocks/autonav/templates/exclude_from_footer/view.php'

Add a page attribute called 'exclude_from_footer' and apply it to all the pages you DON'T want to show on the footer menu.

I modified the autonav template included in the free Boldy theme by Mnkras:

http://www.concrete5.org/marketplace/themes/boldy/...
graphiczweb replied on at Permalink Reply
graphiczweb
A gentleman and a genius! Thank you so much for your time and trouble.

I really hope many others find this as useful as I.

My test site is at:http://graphicz.eu.com/concrete5/... and you will see on the left is an autonav with a template styled for SuperFish and at the bottom an autonav using the css menu from line25.com displaying only those pages that do not have exclude_from_footer ticked (checked). Both are hierarchical.

Very grateful thanks once again.
mhawke replied on at Permalink Reply
mhawke
"Genius is divine perseverance. Genius I cannot claim nor even extra brightness but perseverance all can have."
~ Woodrow Wilson
mhawke replied on at Permalink Reply
mhawke
Perhaps thinking about it the other way around. I have used a Page List sometimes as a nav because you can select pages that have a certain attribute. So as juliandale suggests, you can create a new page attribute but call it 'include_in_footer' and then set the Page List up to grab only those pages that have that attribute.

Or you could try this free add-on and build a nav manually in a stack and then add the stack to the footer area.

http://www.concrete5.org/marketplace/addons/manual-nav/...
graphiczweb replied on at Permalink Reply
graphiczweb
"I have used a Page List sometimes as a nav"

Thanks for that - I would like my lists to be unordered lists with hierarchy (several levels). I think page lists give one level list of selected pages.
mhawke replied on at Permalink Reply
mhawke
Yes, you are correct, Page Lists can pull pages from anywhere based on a page attribute but display is a single flat list.
chris123uk replied on at Permalink Reply
chris123uk