Menumenumenu

Permalink 4 users found helpful
I have two menus, one Main Navigation and then the Second Menu with the "children" (Drupal calls it that) of the Main Navigation. I would like that if i press something in the main navigation, it will go straight to the first "child".

Hard to explain, but check here;
http://www.balticjazz.com/english/press-media.php...

When you click "Press" in the main menu it goes straight to Press>Media and not just any Press-site.

I don't know any other CMS where this is possible dynamically but if there's someway doing it with concrete it would be PERFECT!!

 
frz replied on at Permalink Reply
frz
so you basically just want category pages that are redirects?

so like
About
Our History
Press
Contact
Products
Services

but when I click on about, i get dumped to our history?

That's doable, but it probably means messing around with some template files.

does the navigation ALWAYS behave that way? (for example, is there a product page, or does clicking product above take me to the first product)
xandre replied on at Permalink Reply
no the navigation ALWAYS behaves like this. there simply isn't any products-page, I just want "Products" (for example) to go to the first product. and all pages similar to Products with sub-pages will behave the same way.

I hope it's possible because I've done three websites with navigation this way and I'll rebuild them all with Concrete when/if this is possible.
andrew replied on at Permalink Reply
andrew
This is the behavior it supports.

If you have this in your site

About
Product 1
Product 2
History
Something
Whatever

and you want, when clicking on About, to go to Product 1 instead of About, this will give you what you want. It does so by linking you directly to /about/product1/. If you manually go to /about/, you will not be forwarded on to product1/ (just so you know).

To get this to work, do the following.

1. go into the dashboard, and create a page attribute with the handle "replace_link_with_first_in_nav." Make sure this page attribute type is a check box.
2. Go the page you want to jump FROM (in your example Press, I believe) and add the page attribute to the page, and turn it on.

From then on, whenever press is listed in the nav, clicking on it should take you to the first child of Press, rather than press itself.
jpabellon replied on at Permalink Reply
jpabellon
Parameters like these should be added to the docs. Is this available in 5.1.1?
andrew replied on at Permalink Reply
andrew
Which is why they haven't yet been added...since 5.2 isn't quite "officially" released..
andrew replied on at Permalink Reply
andrew
(sorry, it's early) - you're right...they should be, hopefully along with some other attributes that the system uses (for example...the page list in 5.2 can access an "is_featured" check box page attribute to only display certain pages tagged as "featured"..
jpabellon replied on at Permalink Reply
jpabellon
Hi Andrew thanks! Look forward to this in upcoming releases...
Xscratch replied on at Permalink Reply
Xscratch
Hi
Now we have a stable 5.3, are parameters like these working now? Is there somewhere a help page on this?
frz replied on at Permalink Reply
frz
the jump ot first works in 5.2 i think.. what else you lookin for?
Xscratch replied on at Permalink Reply
Xscratch
I just checked out reading through the view.php and here:http://www.concrete5.org/community/forums/customizing_c5/using_cust...

Are there other page attributes that are hidden but actually working?
olay replied on at Permalink Reply
olay
– I'm really pleased with this simple function, thanks.

however, on my site not only do i need it to jump to the immediate child page but sometimes even to the child's child...

so, in my case for a art gallery website, the set up is as follows

Exhibitions
–Past
--past1
--past2
--past3
-future
--future1
-present
--present1

So the handle "replace_link_with_first_nav" works great to click on "past" and land on the first past exhibition, and the same for the other two.

What i'd like though is the ability for "exhibitions" to land on one of the grandchildren. i.e Exhibitions would take you to the third hierarchy.

Is there a handle like "replace_link_with_first_nav" that could do this?

THANKS
SteveAtParadigm replied on at Permalink Reply
Then the purpose of a menu item with a sub nav would simply be to open the sub nav, not actually link to any page.

That way, you don't have to create a landing page for every sub nav, or a menu system that has duplicate links.

As in the case above, every time a sub nav is further divided, the problem is recreated, so that the 1st child of the sub nav still remains a landing page.
olay replied on at Permalink Reply
olay
Has anyone applied the replace_link_with_first_in_nav code to a pagelist template?

I guess it would require applying this code to a page list template, but i'm not sure where

<?php if ($_c->getCollectionAttributeValue('replace_link_with_first_in_nav')) {
            $subPage = $_c->getFirstChild();
            if ($subPage instanceof Page) {
               $pageLink = $nh->getLinkToCollection($subPage);
            }
         }
          ?>
mobius2000 replied on at Permalink Reply
Hi Everyone,

This post has been a huge help as I have been trying to work out how to do this for some time.

I was just curious what other tricky little built in functions like this are in Concrete5 and not very well documented at this stage.

I know it is a big ask and I love the CMS one way or the other but it would be great to see a little cheat sheet page made with these sort of tricky little functions for ongoing reference.

Just a thought and I don't mean to be asking for massive work hours by someone else, I am a little new to this CMS and love all these built in features, just can't seem to find theme on my own.

:-)

Thank you again for this great solution.
zoinks replied on at Permalink Reply
Unfortunately, I just did this and it isn't working at all.

I am on version 5.3.3.1

I added a page attribute with the handle AND name: replace_link_with_first_in_nav

I made it a "checkbox" type, as instructed.

I applied it to the Parent element "Print."

As you can see, it does not redirect to the first child:

http://php.22graphics.com/print/...
ecomatt replied on at Permalink Reply
ecomatt
did you ever get any code to push you down "two" child pages, or are you still stuck with a single page down replace_link_with_first_in_nav???

i really need to have it when you click on projects(top menu) it take you to residential/project1, currently replace_link_with_first_in_nav will take me to residential, but i want it to take me a step further. can anyone help with this?
ecomatt replied on at Permalink Reply
ecomatt
i looked up getFirstchild attributes on google and found somehting that might do what i want but i dont know how to integrate it...

getLastchild see documentation herehttp://users.etu.info.unicaen.fr/~jacques/phpdom/apidoc/Node.html#f...

is there anyway of adding the corect code to the view.php of autonave that will make this work?
ecomatt replied on at Permalink Reply
ecomatt
iv have been playing with this code but im not really sure what i need to do
$pageLink = false;
         if ($_c->getCollectionAttributeValue('replace_link_with_first_in_nav')) {
            $subPage = $_c->getFirstChild();
            if ($subPage instanceof Page) {
               $pageLink = $nh->getLinkToCollection($subPage);
            }

i just want it to repeat this function so it pushes you down "two" child pages...

any ideas anyone?
zoinks replied on at Permalink Reply
You just have to add an attribute yourself and name it "replace_link_with_first_in_nav" and then it will appear on your list of options for each page just like "remove from nav" or adding metatags, ect.

To add the attribute, Click the Pages & Themes button on the left of the dashboard, then click the Page Types tab at the top of the next screen, then click the Add Attribute button on the bottom.

Then, go to the page you want to redirect, click Properties and add the new Attribute from the dropdown menu. Then, click the little checkbox that appears "Yes." Once you select it, voila, it will redirect to the first child.

In order for this to work I think it has to be a Parent with Children (ie. it must be a yellow folder with contents inside if you're viewing Sitemap). Maybe not, maybe otherwise it will just jump to the next page in the page order.
zoinks replied on at Permalink Reply
Did you ever figure this out? I find myself in the same exact situation today.

If you didn't figure it out, I think what I'm going to do is apply the replace_with_first_in_nav to 2 pages in a row so it will hopefully skip one and then the other.
ThemeGuru replied on at Permalink Reply
ThemeGuru
I did this for a website once.

They wanted the contact page to go directly to a sub page like so.

contact when clicked goes to contact > about.

So all you have to do is create the page attribute (use the check box)

replace_link_with_first_in_nav

Then go to the contact page and then click page properties and then use the attribute "replace_link_with_first_in_nav" and checkmark that.

And publish your edits.

It should work.

If not just PM and we'll figure something out.
zoinks replied on at Permalink Reply
:) That's the same advice I gave the OP. He needed to skip not 1 but 2 pages. And now I find myself in the same situation. So, it would be something like replace_with_second_in_nav (if that were possible).
ThemeGuru replied on at Permalink Reply
ThemeGuru
You could try that. Or else if all else fails you could create an attribute type.
zoinks replied on at Permalink Reply
I have no idea how to create an attribute type. I'm sure there's more to it than just giving it a name, right? :)

Btw, the other option didn't work, so now I've started a new thread.
stretchrt replied on at Permalink Reply
stretchrt
did anyone ever manage to get skipping 2 pages to work? ie page redirects to first grandchild?