Jump to content

Sebii

Members
  • Posts

    34
  • Joined

  • Last visited

Everything posted by Sebii

  1. Hi, 1) Dates might be broken due to output formatting 2) You can acces the fields of the repeater, like you would do with a page. $p = $pages->get("/path/to/currentParent"); $rf = "repeater_field"; //repeater field name $pt = "basic-page"; //page template name foreach($p->$rf as $r){ $r->of(false); //Should make sure raw data are copied. (dates) $np = new Page(); $np->of(false); $np->template = $pt; $np->parent = $p; foreach($r->fields as $f){ $np->$f = $r->$f; } $np->title = $r->field1 + $r->field2 //that's how you should be able to access repeater fields and set the title $np->save(); }
  2. $p = $pages->get("/path/to/currentParent"); And make sure $p is the correct page.
  3. I think just setting a new parent might be problematic, as repeaters don't really use a template (or a generic one?). But it might be sufficient to change the parent and set the template (to a template using the same fields). What Adrian suggested above however sounds very reliable.
  4. Hi, I think to achive this, it might be the easiest if you create a new template with the 6 fields of your repeaters. As repeaters are also just saved as pages, you can select them and iterate over the PageArray. For each of the "repeater-pages" you can now create a new page of your new template (with your initial page as parent) and copy over the values to this new page. Afterwards you can check the pages and delete your repeaters. Greetings Edit: Or see below for the easy way
  5. Thank you very much for the fast reply. I understand the limitation now, but it would be good if there was a warning/message pointing that out, instead of telling that page-100 was created. The idea with the creation date helped me. It's a viable solution and should be easy to implement in my case (only for a single template relevant) without interfering with the exisiting automatic for other pages. Thanks again!
  6. Hello, I found out today, that there seems to be a limitation on the "automatic" renaming of the page-name when using more than 99 pages with the same title under the same parent. e.g. creating a page with title "Test" 99 times (and have processwire setting its name to test-1, test-2 and so on) works fine. However the 100th pages, is then not created properly anymore. (Although there is a message "Created page /pwtest/test-100 using template: basic-page") Instead of actually creating it, it sents me to "Admin> Pages> Page Edit> Bookmarks", and the page 100 was not really created (can't find it in the tree and also not via API) A quick test via API (to create more than the 100th page) worked fine btw! for($i=0;$i<150;$i++) { $clone = $pages->clone($page, $page->parent, false); $clone->save(); } But in the backend, it is still - saying that it created page-100 - NOT creating a new page! - NOT showing the edit-page but the bookmarks instead! Any hints on how to fix this manually (I'd guess there is hook available where I could change the naming)? Is there a chance that it will be changed (fixed?) in 2.7.3? Thanks a lot, Sebii Edit: Also tested with a new local installation of PW 2.7.2.
  7. Thanks for that hint. Upgrading from 2.6.x to 2.7.2 solved my problem. I didn't expect that. Unfortunatly during upgrade process, the file descriptions have all been lost. So I'm not really sure if it was a problem in 2.6.x or maybe something wrong with my installation at all. Also thank you for the hint with the field naming. I was not aware of it.
  8. I checked, no cache on the template. I also couldn't identify any module which could keep a cache of it. Changes on the template are also reflected. It's really just the description that disappears after logout.
  9. Hi all, I'm currently having some trouble to access the (internal) description of a file-field which is contained in a repeater field. My problem is, that I can only see the description when I'm logged in as a superuser, while the page/template which is using this repeater can be accessed by anyone. Also it seems that all other details of the files are available to anyone (as expected). Simplified code which shows my problem: foreach($page->Organizer as $organizer) { foreach($organizer->Files as $file) { echo $file->description; //Only shown to my superuser echo $file->name; //Shown to anyone as expected echo $file->url; //Shown to anyone as expected echo $file->ext; //Shown to anyone as expected } } (Organizer is the repeater field, containing a file field called Files) Any help appreciated. Thanks you
×
×
  • Create New...