Jump to content

psy

Members
  • Posts

    620
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by psy

  1. Had the same issue as @LAPS, ie $vars not accessible in the rendered template. Fixed by including an empty array for $options, ie: <?php $vars = [ 'items' => $items, 'homepage' => pages(1), 'category' => $category ]; echo $files->render('inc/item-detail',$vars,[]);
  2. OK @AndZyk get it after the explanation but a bit confusing without that knowledge. The cursor changing to a text selector on edit threw me. Maybe turn off pointer events to let the user know it's just a display thing?
  3. @AndZyk great work. ? Only other feedback I have is that the buttons "What do I see?", "What do I hear" & "How does the hustle & bustle affect me?" don't go anywhere/show anything. My cursor changed from normal arrow to an 'edit' icon, not pointer on hover. Is this supposed to happen? I'm using Chrome on an iMac
  4. 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
  5. 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
  6. 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"; }
  7. @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; });
  8. 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...
  9. 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 $$$?
  10. @jploch Does this help? On the Template -> Edit -> Files tab, you could nominate an alternative template/path for your PageTable template.
  11. Not sure if related to your issue, but shouldn't that be a double = after $template?
  12. @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.
  13. Same result. I tried that first before changing the column name to 'booking'
  14. 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.
  15. 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 ?
  16. 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.
  17. @kongondo It's related to RockFinder3. Posted in the wrong place
  18. 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?
  19. psy

    Fatal Error

    Please show the code where it falls over... the logs and/or TracyDebugger should help
  20. Not my video - just shared it ?
  21. Hi @bernhard love your work. Is RF2 upgradeable to RF3 or is RF3 a completely different module?
  22. 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
  23. @picarica all good, glad you solved it and no need to apologise ?
  24. @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 ?
  25. 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>"; }
×
×
  • Create New...