Page path underneath external page

Permalink 1 user found helpful
I've got a structure like this

/en/
/en/manufacturing (external page)
/en/manufacturing/design
/en/manufacturing/control

the page manufacturing has no content and therefore links to design.

this works fine so far but the link of design and control is not what I expected. It's /design (in the root)! Which makes it impossible for me to have a page with the same name again even if it's underneath /en or /de!

Remo
 
Remo replied on at Permalink Reply
Remo
I tried to following:

/en/
/en/manufacturing (external page)
/en/manufacturing ("real" page)
/en/manufacturing/design
/en/manufacturing/control

the external page still links to design and since there's a "real page", there's a "real folder"... okay..

but - autonav doesn't work anymore since manufacturing does never get highlighted.....

What's the best way to have a page without content? A page that links to the first child page?
ecomatt replied on at Permalink Reply
ecomatt
did you ever figure out a solution?
i want the external link to link to a page underneath it - this works but the page underneath the external link gets a weird URL
so if you link your external page to
http://yoursite.com/external_link_page/child


when you are on the child page the url looks like this:

http://yoursite.com/external_link_page/httpyoursitecomexternallinkpagechild/child


there must be a way to change how the external link gets its url?
Remo replied on at Permalink Reply
Remo
I work with page attributes a lot. They are easy to process, add some code to your theme (e.g. header.php) to check for the presence of certain attributes like "show first child page", "url" and do whatever you want to do..

It takes some coding, but works
Mnkras replied on at Permalink Reply
Mnkras
Page attribute
Checkbox
Handle: replace_link_with_first_in_nav
ecomatt replied on at Permalink Reply
ecomatt
that is amazing i really need to learn more about attributes. the replace_link_with_first_in_nav handle worked perfect. i feel silly for asking but can you tell me if there is a handle which moves it down 2 ignorantly i tried replace_link_with_second_in_nav but no luck

i also tried puttin the same attribute replace_link_with_first_in_nav on the first child page to see if it move it down one more but i realise it only works when you click on the menu -
ecomatt replied on at Permalink Reply
ecomatt
ok i looked up the child attributes getFirstChild(), and getNextChild(), and getLastChild().
so i located the getNextChild() in the autonav and tried to edit it to have a second one with getNextChild() - but i messed the code up could someone please tell me the correct code to add to the view.php for attribute getNextChild() and or getLastChild()

thanks
Xanweb replied on at Permalink Reply
Xanweb
that´s how i made this, a bit "dirty" and i´m sure there is a better solution but it works and fast to do!
-new page type with no includes (no header and footer)
- a redirect with content=0 within that page type so in your example: /en/manufacturing with a redirect to /en/manufacturing /design
and you´ll have the structure you need!
Remo replied on at Permalink Reply
Remo
don't use dummy page types for this. It's confusing a generates overhead for no reason.

Use attributes like replace_link_with_first_in_nav

It's already used in the autonav block and works well. If you want to make sure that you can't directly enter an address where and empty page would be shown, add something like this to your header.php (theme)

$nh = Loader::helper('navigation');
if($c->getCollectionAttributeValue('replace_link_with_first_in_nav')){
   $subPage = $c->getFirstChild();
   if($subPage instanceof Page){
      $pageLink = $nh->getLinkToCollection($subPage, true);
      header("Location: " . $pageLink);
      exit;
   }
}
ecomatt replied on at Permalink Reply
ecomatt
Any ideas on how you can make the link pass you down "two" child levels. eg
click projects takes you to residential/project1
when you use the repalce link with first in nav clicking projects takes you to residential - i want it to skip overt that and take you direct to the child of residential...

Please can anyone help?
ecomatt replied on at Permalink Reply
ecomatt
Remo i found your code
$children = $_c->getCollectionChildrenArray();
            if ($_c->getNumChildren() > 0) {
               $subPage = Page::getById($children[0]);
               $pageLink = $subPage->getCollectionPath();
            }


and i was wondering if there was any way to edit this to make it move down 2places in the nav (move down two sub pages)

i feel like im talking Chinese as iv posted about this several times but people keep saying use the replace link with first in nav. i dont want first i want first+1

eg

home
projects
- projects sub page
-- projects sub page sub page

i want projects to take you NOT to the first child but the sub page of the first child.

i dont know much about php but i thought maybe by editing the $subPage = Page::getById($children[0]); you might be able to edit to take you the the third level nav if it has a useable id?

any ideas
Thanks
ecomatt replied on at Permalink Reply
ecomatt
i guess what would be amazing is if there was an attribute that allows you to select which page it would lead to.

so if you had a replace with x in nav - and it was a selection box you could then select which page (therfore find its id ) to link directly to. weather this page was first child in nav or second or third.

i realise the external page link can do this but the external page link can not handle having pages dropped onto it - it shows funny in the URL address bar link.