Jump to content

Create page by api and redirect


Spica
 Share

Recommended Posts

well, I shortened it. It has a parent, name, title and creaded user. here the full code

$p = new Page();
$p->template = 'mytp';
$p->name = $myname;
$p->parent_id = $myparentid; 
$p->name = $myName;
$p->title = $mytitle;
$p->created_users_id = $user->id;
$p->save();
$session->redirect($p->url, false);

Creation of pages is working. I used to stay at the page where new pages get created:

$session->redirect("./", false);

but now want to redirect to the newly created page

Link to comment
Share on other sites

Hmm. This morning my code is running without errors. Maybe I was to tired.

Thanks for the help anyway.

To be save I now use

		        if ($p->viewable()) {
		        	$session->redirect($p->url, false);
		        } else {
		        	$session->redirect("./", false);
		        }
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...