Jump to content

psy

Members
  • Content Count

    472
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by psy

  1. Check the id's of each form & its submit button If they're the same for both and depending on your embed method, both will submit when either form is submitted. Had a similar issue a while ago and changing the form ID's to be unique helped. See
  2. Thanks @SIERRA Oops! Just re-read my code and noticed a mistake. Should be: <?php if (!empty($input->get->id) { // PW way of accessing $_GET $id = $sanitizer->int($input->get->id); // Clean it up to ensure it's an integer $alertspage = $pages->get($id); // You can also do $pages->get("id=$id") if (!$alertspage instance of NullPage) { // ensure the page exists echo $alertspage->title; } else { echo "There was a problem retrieving the page with ID $id"; } } Missed the curly braces surrounding the first and last lines
  3. Think the issue may be in this line - no $ in front of id. Try: <?php if (!empty($input->get->id) // PW way of accessing $_GET $id = $sanitizer->int($input->get->id); // Clean it up to ensure it's an integer $alertspage = $pages->get($id); // You can also do $pages->get("id=$id") if (!$alertspage instance of NullPage) { // ensure the page exists echo $alertspage->title; } else { echo "There was a problem retrieving the page with ID $id"; }
  4. @Robin S Brilliant! Not quite what I needed but a great starting point. My scenario was: Didn't know the repeater item id Did know the id of a particular (page) field inside the repeater page And wanted any repeater item with that field id to be locked for editing by all, including super users. Here's what worked for me: <?php $wire->addHookAfter('Field::getInputfield', function(HookEvent $event) { $page = $event->arguments(0); if (!$page instanceof RepeaterPage) return; $inputfield = $event->return; // Only for a particular Repeater page field (fieldtype page) ID if($page->my-page-field->id !== 4486) return; // Set collapsed to Inputfield::collapsedNoLocked or Inputfield::collapsedHidden as suits $inputfield->collapsed = Inputfield::collapsedNoLocked; });
  5. Hi @SIERRA Using pure PW, you can go to Pages ->Find (in the dropdown), select your repeater template then add any other filters, eg Title - Contains Text...
  6. I know that headless cms has been a hot topic for a while. I've experimented with several frontend frameworks (Angular, React, Vue, etc) and I just don't get it. Maybe for huge corporations with multiple dev teams and big budgets, OK. For 95+% of use cases however, I find headless cms/js frontend to be a major pain with no discernible benefits. From a frontend web UX, they're often slower than a well built PW site with caching (eg ProCache). For native apps, something like api calls to/from PW/Dart via json would do the job. Am I missing something other than a desire for JS devs to earn extra $$$?
  7. @jploch Does this help? On the Template -> Edit -> Files tab, you could nominate an alternative template/path for your PageTable template.
  8. Not sure if related to your issue, but shouldn't that be a double = after $template?
  9. @bernhard Grateful for the offer to help, however on a tight schedule and managed to get the solution to my query using a normal PW selector with the very helpful and hard to find gem "repeater_field.owner.field_name'. It enabled me to get the repeater field, it's originating page and the individual repeater item data. The selector returns a WireArray of repeater fields which are then manipulated into a flat array for RockTabulator. From what I could see in the SQL statement from RF3, the field table aliases are getting mixed up when both the first and main RF3 queries have the same field name, eg 'title' - some have the unique id twice and then the LEFT JOIN 'title' gets the wrong one which then fails.
  10. Same result. I tried that first before changing the column name to 'booking'
  11. Don't know what I'm doing wrong but cannot join two RF3 statements when both have the field 'title'. I based it on the example of: <?php $owners = $rockfinder ->find("template=person") ->addColumns(['title', 'age']) ->setName('owner'); // set name of target column $rockfinder ->find("template=cat") ->addColumns(['title', 'owner']) ->join($owners) ->dump(); My case is field 'booking_status' is a page reference field in template 'booking'. <?php $rockfinder = modules("RockFinder3"); $booking_status = $rockfinder ->find("parent.id=1154, include=all") ->addColumns(['title']) ->setName('booking_status'); $rockfinder ->find("template=booking") ->addColumns(['title'=>'booking', 'booking_status']) ->join($booking_status) ->dump(); Each one individually returns the correct data. However when I try to use the join, it errors with "SQLSTATE[42S02]: Base table or view not found: 1146 Table 'xxxxx_xxxx.field_title_5ee33d16934fa' doesn't exist". Both templates have a 'title' field. The SQL dump is: "SELECT `pages`.`id` AS `id`, `_field_title_5ee33bf3cb7d8_5ee33bf3cb854`.`data` AS `booking`, GROUP_CONCAT(DISTINCT `_field_booking_status_5ee33bf3cb92f`.`data` ORDER BY `_field_booking_status_5ee33bf3cb92f`.`sort` SEPARATOR ',') AS `booking_status`, GROUP_CONCAT(DISTINCT `join_booking_status_5ee33bf3cbbbe`.`title`) AS `booking_status:title`, GROUP_CONCAT(DISTINCT `join_booking_status_5ee33bf3cbbbe`.`booking`) AS `booking_status:booking`, GROUP_CONCAT(DISTINCT `join_booking_status_5ee33bf3cbbbe`.`booking_status`) AS `booking_status:booking_status` FROM `pages` LEFT JOIN `field_title_5ee33bf3cb7d8` AS `_field_title_5ee33bf3cb7d8_5ee33bf3cb854` ON `_field_title_5ee33bf3cb7d8_5ee33bf3cb854`.`pages_id` = `pages`.`id` LEFT JOIN `field_booking_status` AS `_field_booking_status_5ee33bf3cb92f` ON `_field_booking_status_5ee33bf3cb92f`.`pages_id` = `pages`.`id` LEFT JOIN ( SELECT `pages`.`id` AS `id`, `_field_title_5ee33bf3cb5c3`.`data` AS `title`, `_field_title_5ee33bf3cb7d8_5ee33bf3cb854`.`data` AS `booking`, GROUP_CONCAT(DISTINCT `_field_booking_status_5ee33bf3cb92f`.`data` ORDER BY `_field_booking_status_5ee33bf3cb92f`.`sort` SEPARATOR ',') AS `booking_status` FROM `pages` LEFT JOIN `field_title` AS `_field_title_5ee33bf3cb5c3` ON `_field_title_5ee33bf3cb5c3`.`pages_id` = `pages`.`id` LEFT JOIN `field_title_5ee33bf3cb7d8` AS `_field_title_5ee33bf3cb7d8_5ee33bf3cb854` ON `_field_title_5ee33bf3cb7d8_5ee33bf3cb854`.`pages_id` = `pages`.`id` LEFT JOIN `field_booking_status` AS `_field_booking_status_5ee33bf3cb92f` ON `_field_booking_status_5ee33bf3cb92f`.`pages_id` = `pages`.`id` WHERE (pages.templates_id=53) AND (pages.status<1024) GROUP BY pages.id ) AS `join_booking_status_5ee33bf3cbbbe` ON `join_booking_status_5ee33bf3cbbbe`.`id` = `_field_booking_status_5ee33bf3cb92f`.`data` WHERE (pages.templates_id=53) AND (pages.status<1024) GROUP BY pages.id " (1933) in .../RockFinder3/RockFinder3.module.php:504 I can add any field in the "template=booking" statement EXCEPT 'title'. Using 'addRelationship' is even worse. It errors with PHP out-of-memory. Using RF3 v1.0.7 and PW 3.0.158 Help appreciated.
  12. Thanks for liking @bernhard Another tip... not only doesn't it work, but who wants multiple CSS files for a repeater? In this scenario, the page template had another RM2 field - simple field on the main template. All CSS for the repeater RM2 field went into the other RM2 field's CSS file, not the repeater field's CSS. I'm sure there are other ways to get the RM2-in-a-repeater's CSS to work - just needs thinking outside the square 😉
  13. I realise this module is deprecated but it is in use on a site I'm working on. I needed to add a RM2 field into a repeater and it didn't work due to the unique nature of repeaters. A little hack to RM2 Inputfield module solved 2 problems at once. The Inputfield works in repeaters AND the repeater item ID is accessible in the parent page via the $session var. <?php /** * Set the field content from the file with the same name */ public function ___getContent() { $out = ''; // get file $name = $this->name; /****** hack - breaks on repeater fields ******/ if (strpos($name,'_repeater') !== false) { // it's in a repeater field $ary = explode('_repeater', $name); $name = $ary[0]; // save the repeater item ID with the original fieldname as the key for future use wire('session')->set($name, $ary[1]); } /****** end of hack - breaks on repeater fields ******/ $file = $this->main()->getFile($name); if(!$file) return "No file found for field $name"; // if a value was set return it if($this->value) $out = $this->value; else { // otherwise try to render the file try { // get page object $page = $this->page; if($this->process == 'ProcessPageEdit') { $page = $this->process->getPage(); } // get markup $out = $this->files->render($file->path, [ 'inputfield' => $this, 'rm' => $this->rm, ], [ 'allowedPaths' => [$file->path], ]); } catch (\Throwable $th) { $out = $th->getMessage(); } } return $out; } It's a bit rough but it works for me and maybe this tip can help others working with repeater fields.
  14. @kongondo It's related to RockFinder3. Posted in the wrong place
  15. Love the way @bernhard has integrated PW selectors/way-of-doing-things in RF3. The doco is really good too. Got the basics no problem. I'm sure I'll figure it out eventually but any tips welcome for this scenario: Client hires out equipment and needs to know 'last and next booking date' for an item and ensure that new bookings don't clash. Simplified template structure is: Booking with: - Event date(s) - Booking items (repeater field) that calls on a list (page reference field) of bookable items Report needs to show (filterable): Item (multiple defined template names) Last booking date Next booking date = availability for a given proposed booking event date Any pointers on how I can achieve this RF3?
  16. psy

    Fatal Error

    Please show the code where it falls over... the logs and/or TracyDebugger should help
  17. Not my video - just shared it 🙂
  18. Hi @bernhard love your work. Is RF2 upgradeable to RF3 or is RF3 a completely different module?
  19. It's fun and wildly different to what I'm used to. It's tight integration with VS Code makes learning much easier. Definitely worth a look
  20. @picarica all good, glad you solved it and no need to apologise 🙂
  21. @kongondo Have been studying/playing with Flutter and catching up on latest trends in CSS, Photoshop, and other stuff during "all this sh*t" (that's what we in Australia call the pandemic that will never be named). Can't "asynch await" to put new knowledge into action 😜
  22. You are looping through the repeater field items (buildings) but not their images (one or many per building) as well. By default an 'images' field can hold multiple images and you simply loop through them. If the only field in your repeater is 'r_galeria_image' then it's unnecessary to have a repeater. foreach ($page->r_galeria_image as $image) { $thumbnail = $image->size(450, 250); echo"<article>"; echo "<a href='{$image->url}' class='fresco' data-fresco-caption='{$image->description}' data-fresco-group-options='preload: [1,2], effects: {spinner: {show:150, hide:150 } }' data-fresco-group='kolace'><img src='$thumbnail->url' alt='obrazok'></a>"; echo"</article>"; }
  23. @shogun This module may help or provide a good starting point: https://modules.processwire.com/modules/admin-restrict-page-tree/
  24. @JoshoB In my case the user is already logged in on the Front End, but you could test with an $input->get var: <?php $vars = ['page'=> $yourPageObject]; $out = $files->render('your-template', $vars); echo $out; exit();
  25. @Robin S Thank you! So many options and as said to Bernhard, will explore when I have time. Right now RockMarkup2 is doing the job with FB and elsewhere in the project. Will replace when the pressure is off
×
×
  • Create New...