Leaderboard
Popular Content
Showing content with the highest reputation on 08/19/2021 in all areas
-
Hi Ivan, I never really looked at API usage up to now (and once I did, I noticed that the module really should be namespaced). Here's a short example for filling values in code: <?php namespace ProcessWire; /* Fill the JsonNativeField field "nativefield" in Page $p through API */ $fdata = new \JsonData(); // This is the class for a JsonNativeFieldValue $fdata->set('first-row', new \JsonValue('text', 'Text in first row')); $fdata->set('second-row', new \JsonValue('integer', 123)); $fdata->set('third-row', new \JsonValue('float', 3.1415927)); $fdata->set('fourth-row', new \JsonValue('date', time()); $fdata->set('fifth-row', new \JsonValue('datetime', time() + 3600)); $p->of(false); $p->nativefield = $fdata; $p->save(); /* Change value for "fifth-row" in our field */ $p>-nativeField->set('fifth-row', new \JsonValue('datetime', time() - 3600)); $p->save();3 points
-
Here you are getting a single page ($pages->get). You are looping through it and the value in each loop is a value of a property in that page. These will mainly be strings (e.g. 'My page title') or integers, but there could be a Pageimages in there as well, if your page template has an images field. Either way, 'My page title'->url does not exist since this is a string (a non-object), hence the notice. This selector returns a collection, a PageArray. When you loop through it, each value in the loop is a Page object. Hence, $pageInLoop->url works. Although it starts with a $pages->get, the chaining of ->children ends up with getting the children of "/", i.e. a PageArray.2 points
-
The HTML Entity Encoder is probably applied to the title field (which is good). So you need to turn off output formatting for $quizPage... $quizPage->of(false); ...or at least get the unformatted value of the title field... $record->title = $quizPage->getUnformatted('title');2 points
-
If the search phrase is coming from user input you'll need to sanitise it through $sanitizer->selectorValue or else there are a range of search phrases that will break your search and cause an error. But "%" is filtered out by $sanitizer->selectorValue by default, because it is a character that is used in a selector operators, e.g. "%=", "%$=", etc. So if it's important that "%" be allowed you'll need to add it in the whitelist option, but bear in mind that this will possibly allow some search phrases that could break the search or return incorrect results. Not sure how likely that is in practice. The basic operators that appear to work with % in the search phrase are *= and %=. The %= operator allows partial word matches so it depends what you want. If you want to match multiple words in any order you'll probably want use an approach where you explode to individual words then build up a selector string.2 points
-
@Robin S Appreciate the help! I was also thinking about a possible conflict between the selector and the value. Will work with your ideas. Cheers!1 point
-
You can do it manually on the ProcessWire side. Before returning the result to the client, simply do the JS trick that you posted in PHP and return the result to the client.1 point
-
Hey Tom. What do you mean "using Node JS server?" Do you mean where the JavaScript files coming from? If that's your question, then it should not matter. It does not matter where the javascript files are coming from. I did a little research and found out that it works in Firefox but not in Chrome. I don't use Chrome, that's why I couldn't reproduce your issue. Have you tried the above JS code in Firefox? If not please try it out and tell me the results. If that works then we will work on fixing it for the Chrome browser.1 point
-
I developed the new Geffen Playhouse website over the course of 2018/2019 and launched it in September 2019. It has been perhaps the largest project I have been involved in. The Geffen Playhouse went through an entire re-branding done by Base (including a custom font), and I worked with Teak on the new website. Website https://www.geffenplayhouse.org/ Wikipedia https://en.wikipedia.org/wiki/Geffen_Playhouse Base write-up https://www.basedesign.com/work/geffen-playhouse-always-geffen-playhouse-always-new Teak SF write-up https://teaksf.com/work/geffen-playhouse-ticketing-ecommerce-website-design/ Another write-up: https://www.laurentakayama.com/geffen Their previous website was severely antiquated and it wasn't a responsive website (as of 2019!). Instead, it forwarded mobile users to a "mobile-friendly" website on a different subdomain, which I think was hosted by a third party service. However the data containing all the actors, shows, seasons, news and press articles were all in there. So one major aspect of this website was de-duping and importing their data into ProcessWire, along with some post-import cleaning… that's ~25 years of data. The site is built with UIkit 3 for the most part, and also uses FullCalendar for the large and small calendars. There is a custom integration with AudienceView, their ticketing system, which is used to import all the performance showtimes of their shows into ProcessWire. It's not the easiest API to work with (XML), but I eventually got it working. Repeater Matrix is being heavily used for section-based page building. Building out all the necessary matrix types took a long time as there was quite a bit of thinking what types and layouts we needed as we went along. However the end result has given the editors a lot of flexibility. ProCache is being used as well, including a CDN for all assets. This is crucial because when opening season sales are announced, the site gets slammed, but with caching turned on, it's not a problem anymore. On a deeper level, the site uses my new (well 2 years old now), universal and very opinionated base module that provides a menu builder, a standard set of fields/templates/pages, and a bunch of other tweaks that I tend to use on every site. All the fields, templates and pages are set up in a streamlined and editor friendly way. I wasn't able to access their previous CMS backend for various reasons (I only got the MySQL dump), so when developing the site and data model in ProcessWire, I was able to completely re-envision the editor experience and the data model without bias. A quote from one of the marketing directors at Geffen Playhouse: "We absolutely love ProcessWire." More details on my personal website: https://jonathanlahijani.com/projects/geffen-playhouse/1 point
-
1 point
-
Haven't tried it, but something like this should work. https://webonyx.github.io/graphql-php/getting-started/ Scroll down to the first example and see how fields are defined in GraphQL. In your case it should look similar to this. <?php $fields[] = [ 'name' => 'intro', 'type' => Type::string(), 'resolve' => function ($page) { return $page->intro; } ]; Play around with it and you'll get there.1 point
-
Hi @tires Of course you can do that! See this example: Place this in site/ready.php (with a current dev version of PW supporting url hooks - otherwise you need to create a custom endpoint for generating the pdf. Or you could use url segments and an if-statement as well): $wire->addHook("/pdf", function($event) { $pdf = $event->modules->get('RockPdf'); $pdf->write('Hello World'); $pdf->download("download-button.pdf"); }); Then add a button to your HTML template file: <a href="/pdf">Your button/link label</a> The content and rendering of the PDF is totally up to you.1 point
-
Work continues on the next master/main version here as we close out older issue reports and finish minor tweaks and adjustments. Eight issues were resolved this week. That might not sound like much, but with the most pressing issues already resolved, more of the GitHub time now goes towards discussion, support and more administrative related stuff, than to actual work in code. Issues remaining and being worked on are those that affect very few and might be more time consuming or difficult to reproduce, or are more subjective. We're very close to our next master version and unless anything new that's particularly pressing arises this coming week, I think we may be there next week. If you have a chance to help us test the current dev branch, please do. Thanks for your help and have a great weekend!1 point
-
1 point
-
That shortcode issue you're seeing was totally my fault. I will push a fix as soon as I can complete it. It will maintain the tags and all other excluded strings properly after that. 5k words! I haven't translated anything that long. As a little test I created a text file with ~5k words in it and the file size was 28kb. The API has a request limit of 30kb and this is almost certainly hitting that ceiling. I need to build out a way for Fluency to analyze the size of the translation, split it up into multiple requests to DeepL, and the re-assemble the multiple translations back into one. Unfortunately this is a hard limitation by the DeepL API so the workaround will have to come from me. I'll put that on the to-do list.1 point
-
Google allows to restrict API keys, but you can only restrict to URLs (useful for showing maps) or IP-addresses (useful for geocoding with PHP). I tested the inputfield using API keys with one of the restrictions each and one with no restrictions. The (expected) result: key restricted only to URL: Map in the inputfield works, geocoding with hitting enter (not clicking outside the field before) works key restricted to IP: Map does not work, but server-side geocoding (with PHP on save) works key with no restrictions (not recommended!): everything works So I think, there should be two fields for the configuration in the module: one for a server-side key and one for a frontend key (also used fro the inputfiled map). Or do I get something wrong? Something else I noticed: In InputfieldMapMarker.module on line 79 and in MarkupGoogleMap.module on line 161 I think the domain should be googleapis.com instead of google.com1 point