Frank Vèssia Posted February 25, 2011 Posted February 25, 2011 I need to move more pages from one parent to main parent changing also the url name from /home/page/ -> /page/. The best way via code?
ryan Posted February 25, 2011 Posted February 25, 2011 For any page where you want to move it, just get the parent page, and set the target page to have that parent, and save: $page = $pages->get("/home/mypage/"); $page->parent = $pages->get("/"); $page->save(); or if you want to do it on one line. -- $pages->get("/home/mypage/")->set('parent', $pages->get("/"))->save(); You'd use the same method to change a bunch of pages: $parent = $pages->get("/"); foreach($pages->find("parent=/home/") as $page) { $page->parent = $parent; $page->save(); }
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