chrizz Posted February 12, 2015 Share Posted February 12, 2015 Hello everyone, following setup I have in my old MODx backend: Folder1Page1 Page2 Page3 Folder2Page1 Page2 Page3 Folder3Page1 Page2 Page3 Folder1 is the defined home page which is reachable under www.domain.com/ Page1 to 3 in Folder1 have a URL like thiswww.domain.com/folder1/page1 www.domain.com/folder1/page2 www.domain.com/folder1/page3 The other folders & pages are reachable like this www.domain.com/folder2/page1 In PW folder2 and 3 will be children of "home" instead of being neighbors like in MODx. To keep my URL structure I'd like to know what the best approach will be... unfortunately at the moment I have no clue... :/ thanks a lot! Link to comment Share on other sites More sharing options...
Jan Romero Posted February 12, 2015 Share Posted February 12, 2015 So with your current structure, Folder1 appears under two separate urls. Once under root, and once under /folder1/. To do this in ProcessWire, you can keep the page structure the same way you have shown, with Folder1, Folder2 and Folder3 as children of the frontpage. They are still “neighbors”, or siblings as PW calls them (you can get a page’s siblings by calling $page->siblings()). Since you don’t want to have a dedicated frontpage, you would create a special template for the frontpage and either redirect it to /folder1/, or render Folder1 right there: <?php echo $page->child->render(); //child gets the first child. //this is the entire template. The redirect would work like so: <?php $session->redirect($page->child); //if you put any code here, it will //not be executed. The first option would be more like what you have now, where the frontpage simply mirrors its first child. You can use the same template for other “category” pages, where you don’t need an overview page, but want to go directly to the first item. For completeness’ sake, this would be the full page tree (just add Home at the top): HomeFolder1Page1 Page2 Page3 Folder2Page1 Page2 Page3 Folder3Page1 Page2 Page3 When you think about it, ProcessWire’s approach makes the most sense anyway. Url paths describe a tree, so it’s only natural that there must be a root page. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now