gunter Posted February 8, 2019 Share Posted February 8, 2019 $calendarPageArray = pages->find($selector); $p = new Page(); // create new page object //some page stuff... $calendarPageArray->add($p); I found out that it doesn´t seem to be possible to add an unsaved page to the pagearray... It´s for a worktime scheduling calendar... a have some real pages with the weekdays and their worktime... and I have also pages with special calendar days with special worktime.. I want get the calendar days from the pagetree into a pagearray... and then adding the generic weekdays as somehow virtual unsaved pages into that pagearray... Link to comment Share on other sites More sharing options...
adrian Posted February 8, 2019 Share Posted February 8, 2019 You need to give it a template, name, title: 2 Link to comment Share on other sites More sharing options...
gunter Posted February 8, 2019 Author Share Posted February 8, 2019 Aaahhhh!! A name! That's it, I didn'nt gave one! Thanks so much, Adrian!!! 1 Link to comment Share on other sites More sharing options...
gunter Posted February 9, 2019 Author Share Posted February 9, 2019 Adrian,please... how did you get that clean pagearray debugging info into the bottom screen? ? Link to comment Share on other sites More sharing options...
dragan Posted February 9, 2019 Share Posted February 9, 2019 See the magic letter d in adrian's last screenshot? ? https://adrianbj.github.io/TracyDebugger/#/debug-bar?id=console 3 Link to comment Share on other sites More sharing options...
adrian Posted February 9, 2019 Share Posted February 9, 2019 Yep d() for dumping to the current output (either the console results or the template file where you call it from), or bd() for bardump which dumps to a dedicated Dumps panel on the Tracy debug bar. Link to comment Share on other sites More sharing options...
gunter Posted February 9, 2019 Author Share Posted February 9, 2019 $days = 20; $selector = "template=basic-page"; $resultPageArray = $this->pages->find($selector); for($i=0;$i<=$days;$i++){ $p= new Page(); $p->template = 'basic-page'; // set template $p->title = rand(); $p->name = "virtual-page".rand(); $resultPageArray->add( $p); } d($resultPageArray); the dumping function is very useful! Unfortunately I have a problem, this code should in my opionion add 20 pages to items... but only one page gets added, the rest are under $resultPageArray->itemsAdded Link to comment Share on other sites More sharing options...
gunter Posted February 9, 2019 Author Share Posted February 9, 2019 problem solved! I have to set a unique id -> then the code from my last posting works - without setting the id -> just one page (the last one) is getting added to the page array $p->id = rand(); 2 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