-
Posts
26 -
Joined
-
Last visited
Everything posted by j__
-
Replacing non-latin characters in string with Sanitizer::translate
j__ replied to j__'s topic in API & Templates
Wow, Robin, that's astonishing! Thank you very much! -
Hi, probably quite simple, but I just can't get my head around this: I've got a string containing non-ASCII characters which I would like to have replaced based on InputfieldPageName module config settings (ä -> ae, á -> a, etc.). Apparenty Sanitizer::translate seems to be usable for PageName only, as in $sanitizer->pageName(string $value). But in this case PageName would limit the string length and replace all space characters with '-', which I do not want. So in short I am looking for $sanitizer->text(string $value, Sanitizer::translate), but it does not exist. What could I do?
-
On a site that lists events, I am using a repeater field 'event_time', which contains two Inputfield Time fields 'event_time_start' and 'event_time_end'. Some events take place multiple times, others just once. Here's an example for the data structure: event1 title: First Event event_time (1): event_time_start: 08:00 event_time_end: 09:00 event2 title: Second Event event_time (1): event_time_start: 08:00 event_time_end: 09:00 event_time (2): event_time_start: 14:00 event_time_end: 18:00 event3 title: Third Event event_time (1): event_time_start: 07:00 event_time_end: 09:30 First, I'd like to generate a list of all events, sorted by event_time_start, with every repeater item added as an actual event (similar to a SQL JOIN clause). The desired output would be: 07:00-09:30 Third Event 08:00-09:00 First Event 08:00-09:00 Second Event 14:00-18:00 Second Event A selector like $pages->find('template=event,event_time.event_time_start!=,sort=event_time.event_time_start'); would only return each event page once: 07:00-09:30 Third Event 08:00-09:00 First Event 08:00-09:00 Second Event without 14:00-18:00 Second Event Is there a possible alteration of the selector to take all different occurrences into account? Also I'd like to filter for events taking place in the morning, using a selector like: $pages->find('template=event,event_time.event_time_start>=06:00,event_time.event_time_start<=12:00,sort=event_time.event_time_start'); However, this would only return each 'event' page, which then contains also the afternoon version of event2. While I have the impression these are rather simple tasks, I struggle finding a selector-based solution to it. In this example on opening times are some similarities, but it does not deal with multiple occurrences. I'd appreciate your ideas to it.
-
Debug mode is off. I use Tracy Debugger on a local PW installation, but haven't seen any information from Tracy on the uploader, the AJAX section is quite empty. Where do I have to look?
-
Did anybody find a solution to this error yet? I recently encountered the same JSON error in a different situation and posts on these errors (https://processwire.com/talk/topic/8712-imagefile-upload-problems-without-errors/, https://processwire.com/talk/topic/16716-jquery-error-in-inputfieldimage/ and https://processwire.com/talk/topic/17132-image-doesnt-save/) read like it's most likely the server setup causing those errors. However, I get the JSON error on just one out of two multi-sites: Both sites use the same server, same server config files and same /wire/ directory, but different /site-*/folders and different databases Image upload and file upload are generally working Upload limits (post_max_size, upload_max_filesize, max_execution_time etc.) are set to values high enough Uploads on site 1 are working absolutely fine and without any errors Uploads on site 2 are working with all files (images, pdf etc.) up to 1 MB (1.023 KB). File sizes > 1 MB (i.e. 1.054 KB or bigger) never finish uploading (with the loader icon spinning endlessly) and lead to the console error: "SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data JqueryCore.js:2:13582 parseJSON https://www.domain.com/wire/modules/Jquery/JqueryCore/JqueryCore.js:2:13582 o/< https://www.domain.com/wire/modules/Inputfield/InputfieldFile/InputfieldFile.min.js:1:4714" I don't quite know where to debug since the server settings are definitely not causing this (since site 1 uploads are working fine). Any idea, why 1 MB/1.024 KB is a invisible limit with these uploads?
-
Payment base class + PaymentStripe + PaymentPaypal
j__ replied to apeisa's topic in Module/Plugin Development
Recently came across the fact that if you use PaymentPaypal, on redirect Paypal shows it's United States customer form regardless what country a customer had chosen on the Processwire website. Maybe somebody mentioned this earlier or even provided a fix. If not: The PaymentPaypal module apparently does not tell Paypal the customer's country. To fix this, add this after line 16 in modules/PaymentPaypal/payment_form.php: <input type="hidden" name="country" value="<?= $customer->country ?>"> Now the Paypal page shows the correct customer form for payment data (and later the right country in Paypal reports as well). -
Came across something strange, maybe anyone of you has seen this before: When I add a new page with template 'simple-page', ProcessWire asks for title and name in order to create the page. I populate the title field and wait for the name field to be filled automatically, i.e.: "Example" for page title and "example" for page name. When I click "Save", the page is being created, loading all other fields for this template. But the fields for title and name are empty again. (And since 'name' is empty, ProcessWire assigns a new name 'untitled' for this newly created page.) Only happens with one template (see structure below) On all new pages with other templates, 'title' and 'name' are assigned just as expected Spotted in ProcessWire 3.0.62, this issue did not appear in an earlier version of the same site using ProcessWire 2.5.3 This is how the template is defined (tidied it up, there's 20+ fields): { "simple-page": { "id": 47, "name": "simple-page", "fieldgroups_id": "simple-page", "flags": 0, "cache_time": 0, "useRoles": 0, "noInherit": 0, "childrenTemplatesID": 0, "sortfield": 99, "noChildren": "", "noParents": "", "childTemplates": [ "special-page" ], "parentTemplates": [ "home" ], "allowPageNum": 0, "allowChangeUser": 0, "redirectLogin": 0, "urlSegments": 0, "https": 0, "slashUrls": 1, "slashPageNum": 0, "slashUrlSegments": 0, "altFilename": "", "guestSearchable": 0, "pageClass": "", "childNameFormat": "", "pageLabelField": "name", "noGlobal": 0, "noMove": 0, "noTrash": 0, "noSettings": 0, "noChangeTemplate": 0, "noShortcut": 0, "noUnpublish": 0, "noLang": 0, "compile": 3, "nameContentTab": 0, "noCacheGetVars": "", "noCachePostVars": "", "useCacheForUsers": 0, "cacheExpire": 0, "cacheExpirePages": [ ], "cacheExpireSelector": "", "label": "Some title", "tags": "", "titleNames": 0, "noPrependTemplateFile": 0, "noAppendTemplateFile": 0, "prependFile": "", "appendFile": "", "tabContent": "", "tabChildren": "", "nameLabel": "", "contentType": "", "errorAction": 0, "ns": "\\", "_exportMode": true, "fieldgroupFields": [ "title", "other_field", "extra_field" ], "fieldgroupContexts": { "title": { "columnWidth": 20, "description": "Put some title here", "label": "Some title" } } } } Any ideas what might cause this issue?
-
Have the same error here: And when I deleted the folder FileCompiler/site/modules/PaymentInvoice, the error is: At least I was working on something related when it occured the first time: I had placed a copy of PaymentInvoice.module (named PaymentFree, to use with zero amount payments) in the modules directory. Debug steps so far: Removed PaymentFree.module from modules directory and cache Removed PaymentInvoice.module from modules directory and cache Refreshed modules, everything's fine again (except for not having PaymentInvoice) Put PaymentInvoice.module back in place, above written error comes back. Removed PaymentPaypal and PaymentModule, re-installed both Cleared compiled files on module page: Error reappears, once PaymentInvoice.modules is in the modules directory Installed PaymentInvoice.module from ZIP file: Error reappears I have the strong feeling the error source is somewhere completely different, but I have no clue how to find it. Only error in logs is the mentioned one.
- 3 replies
-
- fatal error
- debug
-
(and 1 more)
Tagged with: