Jump to content

Recommended Posts

Posted
$p = new Page();
$p->template = 'mytp';
$p->name = $myname;
$p->save();
$session->redirect($p->url, false);

The redirection fails. How to do it?

Posted

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

Posted

what do you get if you echo out or var_dump()

$p->viewable() 
// and / or 
$p->url 
// and / or 
$p->id

right after $p->save() ?

Posted

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);
		        }

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
  • Recently Browsing   0 members

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