Jump to content

Remi

Members
  • Posts

    61
  • Joined

About Remi

  • Birthday 08/21/1984

Profile Information

  • Gender
    Male
  • Location
    Norway / Poland

Recent Profile Visitors

8,396 profile views

Remi's Achievements

Full Member

Full Member (4/6)

23

Reputation

  1. I've tried that before. It doesn't return any results :/ But when I use this selector: $selector = "children.template!=payment"; I receive all pages without children using "payment" template.
  2. SOLUTION below Yep. It works. Corrected code: $selector = "template=invoice"; $results = $pages->find($selector)->not("children.template=payment"); // or: $results = $pages->find("template=invoice")->not("children.template=payment"); // Doesn't work correctly (doesn't exclude pages with children.template=payment (PW 3.0.62 & 3.0.96)): $results = $pages->findMany("template=invoice")->not("children.template=payment"); It also executes 0,5-2 times faster than first working script. I've tried to use findMany method, but it doesn't work with not method.
  3. Hi! I would like to build selector to get pages without children using one template. // Doesn't work: $selector = "template=invoice, children.template!=payment"; // Works but in opposite way I want: $selector = "template=invoice, children.template=payment"; // Works, but it's useless because "invoice" can have other templates as children $selector = "template=invoice, children.count=0"; // Code below works but it gets huge amount of data from DB first :/ $selector = "template=invoice"; $results = $pages->find($selector); foreach ($results as $result) { $hasPayments = $result->hasChildren("template=payment"); if (!$hasPayments){ $content .= "Blablabla"; } }
  4. Hi! I've had a problem with uploading PNG files into Image field. I've had an error: Error: Uncaught Error: Call to undefined function ProcessWire\utf8_encode() in /var/www/domain.com/public_html/wire/core/PWPNG.php:117 Stack trace: #0 /var/www/dksb.turala.com/public_html/wire/core/PWPNG.php(31): ProcessWire\PWPNG->_parsepngstream(Resource id #155, 'image.260x...') #1 /var/www/dksb.turala.com/public_html/wire/core/ImageInspector.php(203): ProcessWire\PWPNG->loadFile('/var/www/domain...') #2 /var/www/dksb.turala.com/public_html/wire/core/ImageInspector.php(129): ProcessWire\ImageInspector->loadImageInfoPng() #3 /var/www/dksb.turala.com/public_html/wire/core/ImageSizer.php(102): ProcessWire\ImageInspector->inspect('/var/www/domain...', true) #4 /var/www/dksb.turala.com/public_html/wire/core/Pageimage.php(479): ProcessWire\ImageSizer->__construct('/var/www/domain...', Array) #5 /var/www/dksb.turala.com/public_html/wire/core/Pageimage.php(346): ProcessWire\Pageimage->___size(260, 0, Array) #6 /var/www/dksb.turala.com/public_html/wire/core/Pageimage.php(632): ProcessWire\Pageimage->size(260, 0, (line 117 of /var/www/dksb.turala.com/public_html/wire/core/PWPNG.php) In this case I've had to install PHP-XML library for PHP-FPM deamon. On CentOS 7 it's: yum install php-xml And after that I've had to restart PHP-FPM deamon: systemctl restart php-fpm I hope this solution will help others with the same problem.
  5. I'll try that It works!
  6. Hi! I've got a page with text area where user can check some codes divided by space, semicolon or comma. I can use two solutions to search for these codes: First method: $prCodesArray = preg_split('/[\\s,;]+/', $prCodes, -1); $selector = "title=" . implode("|", $prCodesArray) . ", template=pr-code, include=all, limit=100"; $prCodePages = $pages->find($selector); $prCodeCount = count($prCodePages); if ($prCodeCount) { foreach ($prCodePages as $prCodePage) { $content .= $prCodePage->title . " - " . "<span title=\"". $prCodePage->parent->pr_code_group_description . "\">" . $prCodePage->parent->title . "</span> - " . $prCodePage->pr_code_description . "<br>"; } } else { $content .= $prCode . __(' - Not found.') . "<br>"; } Advantages: + it's fast ~0.21s for ~40 codes. Disadvantages: - alphabetical results sorting while I want input order, - doesn't show not found codes. Second method: $prCodesArray = preg_split('/[\\s,;]+/', $prCodes, -1); foreach ($prCodesArray as $prCode){ $selector = "title={$prCode}, template=pr-code, include=all, limit=10"; $prCodePages = $pages->find($selector); $prCodeCount = count($prCodePages); if ($prCodeCount) { foreach ($prCodePages as $prCodePage) { $content .= $prCodePage->title . " - " . "<span title=\"". $prCodePage->parent->pr_code_group_description . "\">" . $prCodePage->parent->title . "</span> - " . $prCodePage->pr_code_description . "<br>"; } else { $content .= $prCode . __(' - Not found.') . "<br>"; } } } Advantages: + sorting like input order, + shows not found codes. Disadvantages: - it's slow as hell ~2.5s for ~40 codes. Is there any solution to join advantages of both methods? Also, as you can see I have to use include=all statement in my find methods and I don't know why. I've used Import Pages from CSV module. All codes (pages) are published and there is no access control on any of them.
  7. I've managed to do this module on my own. I can change it to store standard tables of text if somebody would be interested in that. It's possible to change order of the rows on the fly
  8. Yes. I don't understand why. But I've changed module name and made small changes inside. Order of the calls isn't important, now.
  9. I'm working on that, but I've got some problems... On Edit Page I don't receive values for subfield clean from DB. But if I will put them, then they are stored in DB. I can also see them on default view page (See update). I've got a problem on view page. Value of sort is always 0. Can someone help me with these problems? Update: I've solved first problem. I've changed order of 2 lines in protected function renderRow() in InputfieldTranslations.module: $clean = $this->sanitizer->entities($translation->clean); $translation = $this->sanitizer->entities($translation->translation); Why it works and this don't: $translation = $this->sanitizer->entities($translation->translation); $clean = $this->sanitizer->entities($translation->clean); FieldtypeTranslations.module InputfieldTranslations.module Translation.php TranslationArray.php
  10. dragan - I can do that by using another field. But it will make my site slower. I have ~30k pages with translations. My template has these fields: title * transcription abbreviation * part_of_speech article translation * definition * use_case * * - searchable I would like to switch field translation to something similar to Event fieldtype. Even without translation_plain it will be better for me. One word (page) can have many translations. It will also make search more accurate. I would like to sort translations by hand when they are already typed (in the Admin frontend). Take a look: Before: https://www.dropbox.com/s/yp4b5cb68aqr0pg/PW-Before.png After: https://www.dropbox.com/s/jhk8o51ws46ukqc/PW-After.png
  11. I'm working on dictionary. Basically it works fine. People very often type words in search field without national letters (like in old version based on Glossword). Because of that, search doesn't find all similar words. Examples: User want to find: sąd <court> User type: sad <orchard> Search found: sad (it should find also sąd) User want to find: łaska <mercy> User type: laska <stick> Search found: laska (it should find also łaska) Changing DB collations will solve this problem only partially. That's why I want to store two subfields with the "same" data. I believe it can be optimized to save translation_plain only if there are natonal letters in translation subfield.
  12. Hi! I need a new fieldtype for my project. Basically it will be a modification of Events Fieldtype, so that it shouldn't be hard to do. My field don't need "date" part. I would like to store in DB subfields: sort, data (translation), translation_plain. I don't need "date" subfield. I believe that "sort" subfield is clear. Translation and translation_plain subfields will store a short text (like in title field). Translation_plain will have almost the same value as translation. The difference is, that I don't want to have any national letters in this field. They should be converted to ANSI. For example: ą -> a, ę -> e, ś -> s, ł - > l, etc... I need this behavior to make my search less accurate (YES - I need that). That was a backend. Now the admin frontend: Translation_plain subfield should be hidden (backend or js should take care on conversion). I want to change order of subfields by hand. Like in Repeater module. Thats all.
  13. For my needs suffice shared hosting, because right now I don't have more than 4700 views per day. And it's done on Glossword which is much slower than PW.
×
×
  • Create New...