Page hierarchy: pass-through pages?
PermalinkSo it isn't necessary that the top-level page exists (except in the navigation).
You click on "page" but instead of going to
/page
you go to
/page/first-child
How would this be set up, ideally?
Thanks for your help!
http://www.concrete5.ch/board/?topicID=21...
So I get this from that thread (taking out the conditionals...):
$nh = Loader::helper('navigation'); $subPage = $c->getFirstChild(); $pageLink = $nh->getLinkToCollection($subPage); print("the child link: " . $pageLink);
But it doesn't work, giving me this error:
Fatal error: Call to a member function getCollectionPath() on a non-object in [...]/concrete/helpers/navigation.php on line 36
I bet this would be easy if only I knew what I was doing :-)
I think it should be $page->getFirstChild()
(haven't tested it)
So, if anyone wants to force a page to go to its first child page this code at the very top of a page type will do the trick:
Not sure what would happen if the first child happened to be an external link (not a page). Use with caution.
Thanks for your help, Remo!
ps - if there is a way to do this with c5's core (aliases?) I'd love to know about it.
the code needs a minor fix though...
It has an 'a' class of 'nav-path-selected' but so does the 'home'. So if i add a style to that class both the home and portfolio page will have the selected class.
am i doing something wrong?
the site ishttp://www.hawkletsxc.org/c5dev and what the coach wants is for the parent item in the navigation to not link to anything or somehow link to '#'.
If I understand you correctly, this technique won't work for what you're trying to do. This is only if you want the parent item to still be a link, but have it link to the first child item (so two links in the nav go to the same page). The code above is a safeguard in case someone types the address of the parent item in, or has a direct link to it somehow. Otherwise, the auto-nav block can take care of the linking (see the first comment in this thread).
I'm not sure why someone would want a nav link to not go anywhere. As a user I find that frustrating. But I understand you might not be calling the shots :-)
For what you're trying to do, if all top links are to be inactive you could potentially template the auto-nav block to do that. Have it omit the link tags on the first pass through.
.nav > li a:hover { cursor: default; }
http://thenorthernbeaches.com.au...
..the main links are simply category headers.
Most other cms allow for the creation of such links, I think it would be handy to have this capability in Concrete5. The alternative is to go to a sub-page listing the sub-categories, but I find this a bit superfluous?
I want my Parent to redirect to the first Child in my Breadcrumbs navigation.
BUT, if you're going to have other kinds of linkage beside an auto-nav that you want to redirect to that First Child, too, then you just make a special Page Type for that Parent and the full template is basically this code Kirk has come up with. But, as Kutis pointed out, you need to wrap it in <?php ?> tags, obviously.
Thank you!
Thanks!
In the admin area / dashboard look for Page Types and Page Attributes.
There you can create a checkbox/boolean attribute and make sure the attribute handle matches the replace_with_first_.... text (sorry, forgot to copy exactly what it is before I started replying :-)
Then on any given page in the Page Properties you can select that attribute.
Does that help?
I think that property was suggested early on by a power user (Remo?) and the Concrete5 team eventually added it to the core.
But I'm also wondering if this is possible:
With a structure like this...
/section/
/section/page/
*any* link to /section/ will go to /section/page/.
eg if someone types it in
How can this be achieved?