Jump to content

$page->save(); unwanted output frontend


kiral6130
 Share

Recommended Posts

Hello to all of you,

has anybody suffered from following: 

I do something like that: 

$nr = $page;
$nr->of(false);
$nr->foo= $bar;
 $nr->foo2 = $bar2;

 $page->save();

$p = new Page(); 
$p->of(false);
$p->template = 'foobar'; 
$p->parent = $pages->get('/bar/'); 
$p->title = $bar;
$page->save();
 
then populate some more fields and again
 
$page->save();
 
 
Everything is working fine and my created confirm save message pops up....the page is saved, but there are 3 outputs giving me $page->title after saving on the frontend. It has something to do with the save method, because when I leave them out everything is working just as designed...
 
Hopefully somebody has advice! 
 
Regards
Link to comment
Share on other sites

I don't know what's going on with the extra output, but you have issues with your page saving. You should be doing:

$nr->save() or $p->save(), not $page->save()

I guess your first example will probably work as is, but the second one won't save the new page you have created - it will be save the current page that is being viewed, which is always $page. 

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

×
×
  • Create New...