Search the Community

Showing results for tags 'pagetable'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk


There are no results to display.

Found 40 results

  1. Hey there, i've set up a page wich uses pageTable and it works like a charm. for my home page i get several pages. they are sperated in two types: a) page has the module 'featured_img' b) page doesn't have the 'featured_img' my pageTable field is called add_modules. so i was wondering if something like <?php foreach ($featured as $child): ?> <?php if ($child->add_modules->module_featuredimg): ?> // show image <?php else: ?> // show text <?php endif; ?> <?php endforeach; ?> is possible? thanks for your input!
  2. In the admin, I am trying to access data from a page that contains an inputfieldand autofill that data into the modal edit window for a new entry. For instance, I have a template which contains a PageTable field. When I add a new entry to the PageTable, I want to capture the ID from the originating admin page and add it to a field in the edit modal as a way of linking the new entry back to the originating page. The new PageTable entries are NOT children of the originating page, and cannot be for structural reasons. I have attached an image which I hope will help to clarify the basic result I want to achieve. Is there a practical means of accomplishing this? I've been able to achieve something similar with the ConnectPageFields module, but it does not work with PageTable fields. Any input would be much appreciated.
  3. Hi, I've noticed when I trash pages from a PageTable field, then restore them, they are restored to their original location, however the connection is broken with the PageTable field. Is this expected behaviour? Is there a way for it to maintain this relationship? Otherwise restoring it doesn't actually restore it to it's previous state. Note that in this case the parent pages for the PageTable field is not set as the direct parent.
  4. Is there a way to paginate to the contents of a pagetable? I'm currently creating a page with a pagetable field that could possibly have hundreds of pages underneath. Has anybody done this? Thanks.
  5. When a PageTable field in a specific template is being edited I need to know the Page that contains the PageTable so I can fill in hidden fields in the PageTable. I can capture the page being edited via: // $this->addHookBefore('ProcessPageEdit::execute', ... public function pageEditExecuteBefore(HookEvent $e) { $p = $e->object->getPage(); if ($p->template !== 'rtw-product') return; // $p is the page being edited } I can intercept PageTable entry being saved: // $this->addHookBefore('Pages::save' public function savePageBefore (HookEvent $e) { $p = $this->wire('page')->id; $page = $e->arguments('page'); $obj = $e->object; $name = $page->name; // page name of PageTable page $template = $page->template->name; // template of PageTable page $parent = $page->parent->name; // parent directory for PageTable items What I am trying to find is the page in which the PageTable field is located. I've also tried having pageEditExecuteBefore() saving $p in $this->context and then accessing that in savePageBefore() but it's a different instance of the class because $this->context is null when it gets to savePageBefore(). I could save the page ID in session, but that seems error prone. Does anyone know how to achieve this?
  6. Hi, I am trying to create a module for a webshop in which I can predefine a number of thumbnail sizes for my product images. I was thinking of storing each of these image sizes as a child page with 'width' and 'height' fields under the module page , so I can use a PageTable input field in my module to easily manage them. I know how to create a Pagetable field and add it to templates so I can use it in regular pages, but because I am planning on implementing some other functionalities that (I think) can't be achieved with a regular page, I need the PageTable field to work within a module. So far I have come up with this piece of code by trial and error: $page = $this->page; $field_sizes = $this->modules->get("InputfieldPageTable"); $field_sizes->title = "image_sizes"; $field_sizes->label = "Image sizes"; $field_sizes->set('parent_id', $page->id); $template = wire("templates")->get("image_size"); $field_sizes->set('template_id', $template->id); $field_sizes->set('columns', "title\nimage_width\nimage_height"); $wrapper->add($field_sizes); It works in that it does display an empty PageTable in my module. I can also add pages and they will be added as child pages under my module page, but when I do, the way the PageTable is displayed gets all messed up. Instead of showing the newly created page as a row in the PageTable, all the fields on the module page (including the PageTable field itself) are repeated within the PageTable field. I hope my explanation makes sense. I am fairly new to Processwire (and module development in particular) so perhaps I am just trying to use PageTable in a way it was not intended to be. Maybe you guys could give me some directions on how to achieve what I am looking for? Thanks!
  7. I have a Page Table field that, for new entries, I want to construct the name for. When I click the Add New button the page being added has already been given a random name like: 20170422-003744. I wish to 1) change that name so it's obvious it is a temporary name and 2) when either Publish or Save + Keep Unpublished is clicked, set the name of the page based on the content entered. What hooks can I use to accomplish 1 and 2? thanks.
  8. I am wondering if it is possible to hide a field depending on the PageTable field. I would like to hide a field when the PageTable has any child-pages saved (or show only, if there are no pages saved). But I couldn't figure out how or if it is supported at all. product_variations.count!=0 // … hides it in any case product_variations='' // … hides it in any case
  9. Hi all I am looking for a good solution to give my content area more variety. In output, think of the WordPress page builder plugins. I really like you can put together the content depending of what you want to say (visually). In other words, I don't like pages with one content column (text from top to bottom, maybe an image floated to the right, etc.). I know you can create different templates and use them. But still you are stuck to exactly those templates and their repetitive content flow. I had a look at the PageTable field and that was kind of what would be a good solution. I thought I create just content blocks (like a slider, accordion, two/three/four column block, parallax block, etc.) and put them on my pages together as I like. However, those blocks are stored as children and may interfere with actual children of that page, don't they? Any suggestions to get more rich content areas?
  10. Hi, I have the following simplified layout on my page: ... row1_card1 - row1_card2 - row1_card3 row2_card1 - row2_card2 - row2_card3 ... You can add as many rows and cards per row as you like. Each card has a title, text and a button whose text is the same on every card but should be editable too, just not individually. I wonder what is the best approach to do this without making it awfully complicated to setup in the admin from an editors perspective. I thought about a solution using a PageTable for the rows and a Repeater for the cards but that started to be complicated to setup even. It would be awesome if you could use the FrontpageEditing to edit these cards and even add more or add rows. How would you implement it?
  11. Hi, I've created a simple module that does the following: Checks if a checkbox is ticked ('media_wall_quote_hero') on a page using the template 'media_wall_quote'. If that checkbox is ticked, it adds that page to a PageTable field ('quotes_hero') located on the 'home' template. If it's not checked and the page is in the PageTable field it is removed. It all works correctly when checking/unchecking the box on pages using the 'media_wall_quote' template in admin. However, if I edit the pages in the PageTable field itself on the homepage in admin, when I save the modal, the PageTable field is not updated. Strangely if I uncheck it (ie. when it should be removed) the PageTable field says 'item added'. Is there a way I can hook into the PageTable field when the modal is saved and update it so if I check/uncheck the box it does the correct action? public function init() { $this->pages->addHookAfter('save', $this, 'AddRemoveHeroQuotes'); } public function AddRemoveHeroQuotes($event) { $page = $event->arguments(0); if($page->template == 'media_wall_quote') { $home = wire('pages')->get(1); $home->of(false); $work_page = wire('pages')->get("template=work, media_wall_work=$page"); // If this quote is a (published) hero quote add it to the pagetable field if($page->media_wall_quote_hero == 1 && !$page->is(Page::statusUnpublished)) { if(!$home->quotes_hero->has($page)) { $home->quotes_hero->add($page); } } // If this quote is a not a hero quote or is unpublished remove if from the pagetable field elseif($page->template == 'media_wall_quote' && $page->media_wall_quote_hero == 0 || $page->template == 'media_wall_quote' && $page->is(Page::statusUnpublished)) { if($home->quotes_hero->has($page)) { $home->quotes_hero->remove($page); $this->message('removed'); } } $home->save('quotes_hero'); } }
  12. Hi, I have a PageTable field that contains fields that I need populate with values from fields in the containing page when the page is saved. I've tried to do this with a module but I can only get the fields to populate when it's saved for a second time (or saved after publishing), which is not ideal behaviour. Here's my code: public function init() { $this->pages->addHookBefore('save', $this, 'AddWorkReferenceQuote'); } public function AddWorkReferenceQuote($event) { $page = $event->arguments(0); if($page->template == 'media_wall_quote') { if($page->id) { $work_page = wire('pages')->get("template=work, media_wall_work=$page"); $page->media_wall_work_ref = $work_page->work_ref_id; I think the issue is: $work_page = wire('pages')->get("template=work, media_wall_work=$page"); Which doesn't returning the PageTable containing page on first save/publish. I've tried changing the hook to addHookAfter but this has no effect and stops it from working altogether. Anyone have an idea how I can access the containing page of a PageTable page before save?
  13. I have a PageTable field that is updated via a custom module. Pages are updated by deleting them then re-adding but crucially need be re-added in the same order in the PageTable field. If I re-add pages, they go to the bottom of the field (it's a manual drag n drop setting). Is there a way to re-add where the page was previously? Or at the very least I need to maintain the first page in the field. It has a checkbox ticked if it's first so the re-added page could use that to test whether it needs to go first. I just don't know how to set the order of pages in a PageTable field via the api. Any help here much appreciated.
  14. Hi, I have a PageTable field where one template type should only be used once per PageTable as otherwise it will break the lazy-loading pagination on the front-end. Is there a way to limit the number of times a template is used? I think I basically need to create a module that... Checks children of specific template for 'date_listing' template If one child is using the template, disable this template from being available for new pages under that parent Disable the button on the PageTable field for creating a new page with 'date_listing' template (1) is pretty straightforward but (2) and (3) have me puzzled - is it possible to disable template use dynamically?
  15. I have a PageTable field (editions) that I need to access the top page even if the page is unpublished: $page->editions[0]->id This throws up an error when the top page is unpublished, however works fine when it's published. I know I can't access the pages as children because the PageTable order differs from the child order, and I need the top page as it is in the PageTable field. Any ideas how I may be able to do this?
  16. Dear all, I have the following situation: There's a template with a PageTable field. All the PageTable elements may have different templates - let's call them element templates. These element templates use specific stylings and scripts. E.g., one element contains a contact form (built with FormBuilder) that needs form-specific CSS and JS. The page elements are not direct children of the page. They're attached to a separate page that serves as an element container. But that's just an aside. I general, when it comes to rendering my pages, I am following the "delayed output" strategy suggested by Ryan. Now my question is this: When I render the (main) page with all its PageTable elements (with possibly different templates), how do I include all the elements and their templates in the rendering strategy? Of course, in my (main) page template I could simply iterate over the elements and render them. However, at the time of rendering these elements, I haven't included their custom styling and script requirements yet. I should somehow do that before so that such specific stylings etc. can be included in the <head> section of the generated output. I hope you understand what I am trying to convey. I just want to do it the beautiful way, or the PW way Any suggestions are appreciated.
  17. My code looks like this: //the page $p = new \ProcessWire\Page(); $p->template = 'template'; $p->parent = $site->pages->get('/parent/'); $p->title = 'title'; $p->save(); // the child pages for the pagetable field $d = new \ProcessWire\Page(); $d->template = 'template_pagetable'; $d->parent = $p->id; $d->title = 'title'; $d->save(); $p->save(); I get the page and it's children created, but the pagetable field doesn't have those pages set instead they are displayed as a checkbox list How can I add the child pages to the pageTable field?
  18. Hi all! I would like to use pageTable with existing pages. The page I wanna use the pageTable on is not the parent of pageTable items. But when I add the pageTable field to the page ti shows no data. I used it like this in the past and I was able to add orphans using checboxes. Am I doing something wrong or was maybe pageTable updated in some way that it´s not supported now? Thank you!
  19. I ran across this problem after I updated to PW 3.0.21 last night. The Automatic Page Name Format stopped working on my PageTable, In PW 3.0.21 it would now ask for the Name of the page I reverted back to PW 3.0.20 and the Automatic Page Name Format works, as it should' If I revert back to PW 3.0.21, it stops working again. Github Issue opened on this problem
  20. Sometimes I had to reset/ delete parent_id in settings of a PageTable field to force items be placed as children of the page being edited. I did this always by manipulating the database. Other way is to delete the field and create a new one. Both ways are not very comfortable. Is there a better way? Am I missing something? Would be nice to have this option from the field settings.
  21. PW: 2.7.3 User role: superuser I have a page with a PageTable field. The field worked just fine, but suddenly when I re-order items in the PageTable on that page via drag and drop and hit save, the re-ordering doesn’t get saved and the old item order appears. Very odd … The PageTable on all other pages with the same template work properly. I tried to clone the problematic page, and tried to reproduce the problem, but I couldn’t on the cloned page! it works. I then deleted the original problematic page, and renamed the clone page to match the name of the original one (the cloned page had, of course, the "-1" suffix in the page name). After the renaming, the problem came back! So apparently my ProcessWire installation has a problem with the name of the problematic page (which is "/ueber-uns/" and "/about-us/" [it’s a multi-lingual setup], by the way, so nothing fancy). I have no idea, how I can fix this issue, and I’m pretty nervous because the editors can’t change the appearance of the page due to this issue.
  22. I am trying to add information about users of my website to a pageTable field called 'user_notes', which I added to the 'user' template. The parent of the pageField pages is a user, so every user can have child pages with a 'note' template. Adding new notes to this pageTable works great when I'm logged in as the superuser, but when I try to do this logged in as a 'planner' user, the child pages are created but they are not added to the pageTable array. I'm not sure why, as I've been looking at every involved permission setting and I just can't seem to find out what might be going wrong. Here are some details: I have created a user role called 'planner'. It has all the 'page-edit' (sub)permissions. I have a pageTable field called 'user_notes'. The pageTable 'user_notes' creates pages under a 'user' with a 'note' template. The 'planner' role has all permissions to edit/create pages using this 'note' template.
  23. Is there a way to filter a pagearray you get from the pagetable? As I know something like this wouldn't work because you can't filter pagetable i think? Is there probably an alternative how i coud get this to work: //get all dates of the current acitivty Page from the pagetable where date_from is bigger or equal to today. $filteredPagetable = $page->activity_create_date($selector[e.g "date_from>=today, sort=date_from"]); //check filtered pagetable array & get the latest date from the first item in array. $dateFrom = (count($filteredPagetable)) ? $filteredPagetable->first->date_from : "";
  24. I have a template file that receives some form data that I save to a pageTable field. I use the pageTable to add notes to user profiles, so every user can have child pages containing a note and a date. Here's what I use: $notes = $input->post->textarea('notes'); // Passed via javascript. $customerId = $input->post->int('id'); $customer = $users->get($customerId); $newNote = new Page; $newNote->template = 'user-notes'; $newNote->parent = $customer; $newNote->of(false); // turn off output formatting before setting values $newNote->save(); $newNote->title = 'user note'; $newNote->notes_date = date('Y-m-d H:i:s'); $newNote->notes = $notes; $newNote->save(); // So far so good, but this bit does not work: $customer->user_notes->add($newNote); $customer->of(false); $customer->save('user_notes'); // Just as an example, this part DOES work: $customer->gender = 2; $customer->save('gender'); The child page is created but it is not added to the user's 'user_notes' pageTable. If I place this code in my admin module, it works as expected. Any ideas what could be going wrong? Edit: fixed it by switching these lines around: $customer->of(false); $customer->user_notes->add($newNote); Now it works as expected. Strange it works in the other order on another page, but there you go.
  25. Hello, I am building a modular layout via PageTables. Are PageTables nestable? E.g. i am using a content field (PageTable) where I insert a template called test. If I use a PageTable in this test template, will everything work? If this doesn't work, is there an alternative for this?